Reputation: 25
Given a table "book" like the following
[name] [date] [author]
bookA 2019-08-12 Charles
bookB 2020-09-30 Jane
bookC 2019-08-12 Adam
The desires output is the following (find the oldest date and if the date are the same order by author)
[name] [date] [author]
bookC 2019-08-12 Adam
bookA 2019-08-12 Charles
I tried the following but the output was just the listing of all books in the order of the authors.
SELECT author, min(date)
FROM book
GROUP BY author
ORDER BY author;
Upvotes: 0
Views: 264
Reputation: 5697
select author,date from book
where date=(select min(date) from book)
order by author
Upvotes: 1