mardi 8 septembre 2015

Query N elements with column values smaller than an input

Here's a basic (I hope so) question about SQLite queries. Let's say I have the following table:

 id    value
-------------
 0     100
 1     200
 2     300
 3     150
 4     250
 5     350

What statement should a use in order to get N elements with 'value' smaller than X (the least negative ones). For example, for N = 3 and X = 280 the result would be:

 id    value
-------------
 1     200
 3     150
 4     250

Aucun commentaire:

Enregistrer un commentaire