Is it possible to return a max value from a table ...
# squarelibraries
a
Is it possible to return a max value from a table in SQLDelight? I'm trying
Copy code
retrieveMostRecentLastModificationDate:
SELECT MAX(Information.lastModificationDate) FROM Information LIMIT 1;
And it is returning Query<RetrieveMostRecentLastModificationDate> I just need to return the most recent date from the table, so I would expect it to return as an Int or a Long as we are storing it using toEpochMilliseconds
e
What happens if you remove the
LIMIT 1
(
max
should only ever return one value)?
a
It shows this:
Not sure on why its trying to return the SQL Query name
a
its just a wrapper, it probably holds the value you want
it has to be wrapped i assume because your last modification date is nullable
a
yeah calling .MAX on it returns it. That explains it more, thanks Alec