SQL: How do I get just the first row of a result set?
I need to get the first row returned from a select query that looks like this:
SELECT DISTINCT parm1 FROM table1 WHERE parm1 > 10 ORDER BY parm1
Can someone please show me how to do this?
Originally Posted by bort
select * from (
SELECT DISTINCT parm1 FROM table1 WHERE parm1 > 10 ORDER BY parm1 )
where rownum < 2
SELECT min(parm1) FROM table1 WHERE parm1 > 10
would achieve (almost) the same result in this case.
Almost being, this would return null if there were no records, rather than a no rows returned/no_data_found
That's exactly what I ended up doing. Thanks for the replies!
Originally Posted by gamyers
Click Here to Expand Forum to Full Width