Is there a simple way to select the first and last records in a query, after ordering them? I know I can do two separate queries to get them, but I'm wondering if there's a faster/simpler way.
Will these work for you?
SELECT MAX(field), MIN(field) FROM table WHERE condition;
SELECT a.field, b.field FROM table a, table b WHERE condition ORDER BY a.field DESC, b.field ASC LIMIT 0,1;