开发者

select DISTINCT dates from mysql table

开发者 https://www.devze.com 2023-02-18 21:25 出处:网络
I want to select the DISTINCT dates (ignore开发者_开发百科 time) from the table; then for each date, I want to select all data for that date? Don\'t execute a query for each date, rather you should do

I want to select the DISTINCT dates (ignore开发者_开发百科 time) from the table; then for each date, I want to select all data for that date?


Don't execute a query for each date, rather you should do something like:

SELECT DATE(date_column), other_column FROM your_table ORDER BY DATE(date_column)

And when you are processing your result set pay attention to whether the date result has changed.

This way you only dispatch one query.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号