--- Emily Berk <[EMAIL PROTECTED]> wrote: > Let's say I have a set of records and I want to retrieve the first and the > last (ordered by, say, the value of one of the columns). > > Is there > > To get either the first or the last, I'm assuming I would > > Select * order by columnX ASC LIMIT 1 > > and to get the last I'd order descending. > > But how would I get both the first and the last in one query? > > Emily Berk > http://www.armadillosoft.com
You could UNION the two queries: SELECT * ORDER BY columnX ASC LIMIT 1 UNION SELECT * ORDER BY columnX DESC LIMIT 1; James Keeline
