How get TOP 10 DISTINCT dates

M

mscertified

I have a table with a date/time field. I need to get the top 10 distinct
dates (ignoring time portion). I tried:

SELECT DISTINCT TOP 10 Format(RecordDate,'MM/DD/YYYY') AS RecDate
FROM tblAddress
ORDER BY Format(RecordDate,'MM/DD/YYYY') DESC;

but it gave me all the same dates.

How do I do it?
 
M

Michael Gramelspacher

I have a table with a date/time field. I need to get the top 10 distinct
dates (ignoring time portion). I tried:

SELECT DISTINCT TOP 10 Format(RecordDate,'MM/DD/YYYY') AS RecDate
FROM tblAddress
ORDER BY Format(RecordDate,'MM/DD/YYYY') DESC;

but it gave me all the same dates.

How do I do it?
maybe this is all it would take:

SELECT TOP 10 Format(RecordDate,'MM/DD/YYYY') AS RecDate
FROM (SELECT DISTINCT RecordDate FROM tblAddress) AS t
ORDER BY Format(RecordDate,'MM/DD/YYYY') DESC;
 
K

KARL DEWEY

Try this --
SELECT DISTINCT TOP 10 CVDate(Int([RecordDate])) AS Dates
FROM tblAddress
ORDER BY CVDate(Int([RecordDate])) DESC;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top