Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Combine two date queries

Author  Topic 

JGroot
Starting Member

1 Post

Posted - 2012-05-23 : 09:47:19
I only want to have one date column.

Right now I have two. One is where I aggregate by day and the other is where I add 2 hours, because I need to report on a different timezone.

Can Anyone help me to combine the two, so I have one aggregated date column + 2 hours?

Right now I have:

SELECT
CAST((YMDH + 2 * INTERVAL '1 HOUR') AS DATE) AS "CET Date (copy)",
DATE_TRUNC( 'DAY', YMDH ) AS "CET Date",

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-05-23 : 09:54:10
what does DATE_TRUNC do ?

Are you using SQL Server ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-05-30 : 04:01:04
Post in Oracle forums like www.orafaq.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -