I am not very good with this, so I hope somebody can help me. I have a t开发者_如何学编程able filled with measurements. These measurements are taken every 30 seconds over the last 3 years, during most of the days. I would like to have a list with all the dates available in the table. So something like:
31//1/2010
1/2/2010
2/2/2010
4/2/2010
It does not matter how many measurements were taken on a certain day, as long as there is one then it should show the date. In the above example it shows that there are no measurements taken on 3/2/2010.
Is there a simple mysql select statement that can do this?
my table looks like this:
table1:
int id (auto, prim)
datetime measurementTime
double value1
double value2
SELECT DISTINCT DATE(`column_with_date_and_time`) AS `date`
FROM `table` ORDER BY `date`
Try this:
SELECT DISTINCT date_col FROM your_table
if your table stores date and time separately.
On the contrary, use this:
SELECT DISTINCT DATE(date_time_col) FROM your_table
精彩评论