Selecting two specific mysql table rows in a single query

Posted by Scotta on Stack Overflow See other posts from Stack Overflow or by Scotta
Published on 2010-05-11T21:57:07Z Indexed on 2010/05/11 22:04 UTC
Read the original article Hit count: 128

Filed under:

Lets say I have a table with 20 entries. They are sorted by date (date is a column name >_>) in descending order. How would I go about selecting ONLY the newest entry and the 15th oldest entry?

I am getting all 15 results by doing the following query

SELECT * FROM mytable m WHERE col1 = "zzz" ORDER BY date DESC LIMIT 15;

© Stack Overflow or respective owner

Related posts about mysql