How to select DISTINCT dates from a Date/Time field

I'm trying to select distinct dates from a Date/Time field
Tried something like

SELECT DISTINCT left(myDate,11) AS dateList FROM myTable

Unfortunately, it returns the date converted to string, no good.

Any right way of doing this?

Thanks

Ion
LVL 2
iamariAsked:
Who is Participating?
 
Gustavo Perez BuenrostroConnect With a Mentor Commented:
Try next query and post your opinion:

select distinct convert(datetime,convert(varchar,myDate,112)) from myTable
0
 
iamariAuthor Commented:
Thanks a alot, works like a charm!

Ion
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.