I have a table in PostgreSQL , I run a query on it with several conditions that return multiple rows ordered by one of the columns. In general, these are:
SELECT <some columns> FROM mytable <maybe some joins here> WHERE <various conditions> ORDER BY date DESC
Now I'm only interested in getting the first and last line from this query. I could get them outside of db, inside my application (and this is what I actually do), but it was interesting if for best performance I should not get from the database only those 2 records that really interest me.
And if so, how can I change my request?
sql postgresql
kender Sep 28 '09 at 4:16 2009-09-28 04:16
source share