"Unique Day" in a datetime field 
Author Message
 "Unique Day" in a datetime field

Hi,

I need to return each unique or DISTINCT day that occurs
in a field (theTime) in a table (theTable).

Actually, I'll be asking for each DISTINCT day less than
some instance (but that's not an issue).

field (theTime) is of type datetime and typically has one
record inserted into it each second of the day...

--This is close, but it returns the day of the week
select distinct day(theTime) from theTable

ie:  6 and 7 for Saturday and Sunday

I want the actual date

ie:
3/2/2003
3/3/2003

Thanks in advance,
Ben



Mon, 29 Aug 2005 05:39:19 GMT
 "Unique Day" in a datetime field

SELECT DISTINCT CAST(CONVERT(VARCHAR,crdate,112) AS DATETIME)
 FROM sysobjects

--
David Portas
------------
Please reply only to the newsgroup
--

Quote:
> Hi,

> I need to return each unique or DISTINCT day that occurs
> in a field (theTime) in a table (theTable).

> Actually, I'll be asking for each DISTINCT day less than
> some instance (but that's not an issue).

> field (theTime) is of type datetime and typically has one
> record inserted into it each second of the day...

> --This is close, but it returns the day of the week
> select distinct day(theTime) from theTable

> ie:  6 and 7 for Saturday and Sunday

> I want the actual date

> ie:
> 3/2/2003
> 3/3/2003

> Thanks in advance,
> Ben



Mon, 29 Aug 2005 05:53:14 GMT
 "Unique Day" in a datetime field
select convert(char(20),getdate(),101)
Quote:
>-----Original Message-----
>Hi,

>I need to return each unique or DISTINCT day that occurs
>in a field (theTime) in a table (theTable).

>Actually, I'll be asking for each DISTINCT day less than
>some instance (but that's not an issue).

>field (theTime) is of type datetime and typically has one
>record inserted into it each second of the day...

>--This is close, but it returns the day of the week
>select distinct day(theTime) from theTable

>ie:  6 and 7 for Saturday and Sunday

>I want the actual date

>ie:
>3/2/2003
>3/3/2003

>Thanks in advance,
>Ben
>.



Mon, 29 Aug 2005 06:34:53 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. How to make a "decimal"-field to an "integer"-field

2. The "Edit"-method and an idexed, primary and unique field

3. The "Edit"-method and an indexed, primary and unique field

4. datetime "zero" field problem

5. Trying to update a "datetime" field

6. aReport."Field".SetFilter("this")?

7. max of ("...","...","..")

8. Data Type "DATE" vs "DATETIME YEAR TO DAY"

9. Oracle's "Java Day"

10. Oracle's "Java Day"

11. Day name like "MON" from query

12. A "days at" query


 
Powered by phpBB® Forum Software