jeudi 21 mai 2015

Android SQLite select maximum value that is less than another value

Example Schema: Table(Id, Time).

How can I go about selecting the row with the maximum Time that is less than another given Time (i.e. the previous time)?.

I was thinking something along the lines of:

`SELECT MAX(Time) FROM SELECT * FROM Table WHERE Time < x`  

but I can't remember the proper syntax or if there is another more efficient way.

Aucun commentaire:

Enregistrer un commentaire