[thelist] SQL Query - Select Distinct Dates in Date/Time Field

Anthony Baratta Anthony at Baratta.com
Fri Feb 22 11:12:01 CST 2002


At 08:37 AM 2/22/2002, Ben Dyer wrote:
>I have a table with a date/time stamp field in it.  I'm trying to select
>the distinct *dates* (not date/times) from the database.
>
>This was the query I was trying on a coworker's recommendation:
>
>SELECT          DISTINCT CONVERT(varchar, dtJoined, 101) AS dtJoinedDate
>               , dtJoined
>FROM            tblTable
>ORDER BY        dtJoined

Try this:

SELECT          DISTINCT CONVERT(varchar, dtJoined, 101) AS dtJoinedDate
FROM            tblTable
ORDER BY        CONVERT(varchar, dtJoined, 101)

---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list