Wondering how to return the 1st row in a MySQL group by vs. the last row. Returning a series of dates, but need the first one displayed.
select * from calendar where approved = 'pending' group by eventid;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
minfunction insead ofmaxto return the first row in a group vs the last row.If you want the entire row for each group, join the table with itself filtered for the min dates on each group:
Demo: http://www.sqlize.com/6lOr55p67c