On 12/1/2016 11:55 AM, Baruch Burstein wrote:
On Thu, Dec 1, 2016 at 9:12 PM, James Walker <jam...@frameforge3d.com>
wrote:

Let's say I have a table INFO with columns PRICE and IDENT, and I want to
find the IDENT of the row with the minimum value of PRICE.  In SQLite 3, I
can say

SELECT MIN(PRICE), IDENT FROM INFO;

and get what I want.  But in SQLite 2 (legacy code), this doesn't work...
I get the minimum value, but NULL in the IDENT column.  I could say

SELECT PRICE, IDENT FROM INFO ORDER BY PRICE;

and ignore all but the first row of the result, but I'm sure there must be
a better way?


LIMIT 1?

Yes, LIMIT 1 does it. I knew there had to be a simple way.  Thanks.

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to