MYSQL shows incorrect rows when using GROUP BY
问题 I have two tables: article('id', 'ticket_id', 'incoming_time', 'to', 'from', 'message') ticket('id', 'queue_id') where tickets represent a thread of emails between support staff and customers, and articles are the individual messages that compose a thread. I'm looking to find the article with the highest incoming time (expressed as a unix timestamp) for each ticket_id, and this is the query I'm currently using: SELECT article.* , MAX(article.incoming_time) as maxtime FROM ticket, article