Solved

How to select DISTINCT dates from a Date/Time field

Posted on 2000-04-28
2
527 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:iamari
2 Comments
 
LVL 4

Accepted Solution

by:
Gustavo Perez Buenrostro earned 100 total points
ID: 2761218
Try next query and post your opinion:

select distinct convert(datetime,convert(varchar,myDate,112)) from myTable
0
 
LVL 2

Author Comment

by:iamari
ID: 2766039
Thanks a alot, works like a charm!

Ion
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Is there a better way to combine two queries 7 25
SQL Backup Question 2 29
SQL query and VBA 5 41
Are triggers slow? 7 10
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question