Reputation: 28379
if I run a SELECT query that returns 10 rows, is there a way to select the 2nd item in the result set right in the SELECT statement (effectively getting a single row result)?
psedudo code:
SELECT id from MYTABLE where MYTABLE.foo = 0 and RESULT_INDEX = 2;
this would return the 2nd item from a multi item result set.
Upvotes: 1
Views: 1879
Reputation: 164901
SELECT id from MYTABLE where MYTABLE.foo = 0 LIMIT 1, 1;
You'll probably want to specify an ORDER BY
clause or else the nth result will be arbitrarily defined.
Edit: Oops, the first LIMIT
param is zero based
Upvotes: 3