Silly little date question 
Author Message
 Silly little date question
I should know this.  I can't wrap my head around it right now though.

I want to pull out data for the last week (starting Monday)
If it was last month I would simply use

select min(date_time),max(date_time)
from emailcollection
where datediff(ww,date_time,getdate()) = 1

since this would give me the 1st to 30th or 31st etc of last month.

Is there a way to do this for a week starting Monday morning eg 12:00:01
am?

Thanks.



Tue, 09 Dec 2003 04:37:42 GMT
 Silly little date question

Nevermind.....
I guess I answered my own question
Quote:

> I should know this.  I can't wrap my head around it right now though.

> I want to pull out data for the last week (starting Monday)
> If it was last month I would simply use

> select min(date_time),max(date_time)
> from emailcollection
> where datediff(ww,date_time,getdate()) = 1

> since this would give me the 1st to 30th or 31st etc of last month.

> Is there a way to do this for a week starting Monday morning eg 12:00:01
> am?

> Thanks.



Tue, 09 Dec 2003 04:41:16 GMT
 Silly little date question
If you have to do a lot of calendar calculations, consider building a Calendar tabloe with fiscal years, quarters, holidays, week starts, etc in columns of the table keyed on the actusal date.  

--CELKO--

SQL guru at Trilogy
===========================
Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, datatypes, etc. in your schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 09 Dec 2003 04:46:24 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Silly little Access question

2. Date Formats (silly question)

3. Silly Date Question

4. Silly little tool for making parallel_schedule variants

5. PDOX45 Applets?? and Silly little problem

6. Need help with finding greatest date less than a date

7. Help Finding dates less than todays date?

8. Silly db date problem/?

9. silly question maybe

10. Query analyzer (a silly question)!

11. Silly Question about migration to MSSQL

12. A rather silly question about transformation


 
Powered by phpBB® Forum Software