"Unique Day" in a datetime field

"Unique Day" in a datetime field

Post by ben » Fri, 14 Mar 2003 06:39:19



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

 
 
 

"Unique Day" in a datetime field

Post by David Porta » Fri, 14 Mar 2003 06:53:14


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


 
 
 

"Unique Day" in a datetime field

Post by jose de jesu » Fri, 14 Mar 2003 07:34:53


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

 
 
 

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

Hello
It is probably very easy, but I can't figure it out:
A field in a table on my MSSQL-server is at decimal-field, but in a view I
would like to use the field as an integer-field. I have tryed the SQL-code:

SELECT Int([Tabel1]![Felt2]) AS Udtryk1
FROM Tabel1;

but it dosn't work ! How do I do that ?

Thanks, Mads.

2. announce : mailing list for massive database

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

4. Hello!

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

6. how to copy recordset to another database

7. datetime "zero" field problem

8. How many records?

9. Trying to update a "datetime" field

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

11. max of ("...","...","..")

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

13. Oracle's "Java Day"