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

Joshua Olson joshua at alphashop.net
Fri Feb 22 10:47:01 CST 2002


Hey Ben,

This problem might be a good candidate for a view.

Create a view that has the same fields as the table, except that you'll add
a new column that is coversion:

CREATE VIEW myView AS
SELECT [fields], CONVERT(varchar, dtJoined, 101) AS dtJoinedDate
FROM tblTable

(I may have the view syntax wrong for your DB... if so, sorry)

Then, run your select distinct off the view instead of the table.

ie.

SELECT DISTINCT dteJoinedDate, [other fields]
FROM tblTable
ORDER BY [whatever]

HTH,

-joshua

----- Original Message -----
From: "Ben Dyer" <ben_dyer at imaginuity.com>
Subject: [thelist] SQL Query - Select Distinct Dates in Date/Time Field


> 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.




More information about the thelist mailing list