MYSQL select and limit by quantity of 'group by'
My query is as follows:
$query = "SELECT report,";
$query.= "GROUP_CONCAT(DISTINCT analyst) AS analysts, ";
$query.= "GROUP_CONCAT(DISTINCT region) AS regions, ";
$query.= "GROUP_CONCAT(DISTINCT country) AS countries, ";
$query.= "GROUP_CONCAT(DISTINCT topic) AS topics, ";
$query.= "GROUP_CONCAT(DISTINCT date) AS dates, ";
$query.= 开发者_Python百科 "GROUP_CONCAT(DISTINCT link) AS links, ";
$query.= "GROUP_CONCAT(DISTINCT province) AS provinces ";
$query.= "FROM reports GROUP BY report ORDER BY dates DESC ";
I would like for MySQL to GROUP BY report, and also to limit that number (of reports) to 10. Any suggestions?
Simply add LIMIT 10
to the end of your query.
精彩评论