Dear All, I have some records with a datetime field. datetime filed type is varchar. So, how can I use group by command to group by date (not datetime). sample records: name---------Class---------date Alam---------xxx-----------20100515041145 Selim---------xxx-----------20100515041155 Sohel---------xxx-----------20100615041202 I need to getting records by grouping date (i.e. 20100515 and 20100516) so, what will be query???? Please help Thanks advance.
I'm assuming the date column is an int, char or varchar and not a datetime type, this should be the most efficient way to do it. GROUP BY LEFT(`date`,8)