I am trying to select the latest comment for each business that has at least 1 comment. In a seperate query, I’m trying to select the oldest comment for each business that has at least 1 comment.
These below queries are identical other than that I use Max instead on Min in the second. Yet they produce a different number of results (1180 results for MIN & 673 for MAX). Very confused??? Can anyone help
SELECT comment.bis_id, comment.comment, comment.date
FROM comment
GROUP BY comment.bis_id
HAVING comment.date = MIN(comment.date)
SELECT comment.bis_id, comment.comment, comment.date
FROM comment
GROUP BY comment.bis_id
HAVING comment.date = MAX(comment.date)
In this case you should use these queries –