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

Author  Topic 

fengfeng
Yak Posting Veteran

64 Posts

Posted - 2011-04-27 : 15:59:36
IFNULL(SUM( CASE WHEN gb.date BETWEEN line.start_date AND line.start_date + INTERVAL 6 DAY THEN
gb.volume
END ),0) AS 'Volume_First_7',



I have the following query and instead of between line.start_date and line.start_date +interval 6 day, I want gb.date between min(gb.date) and min(gb.date) + interval 6 day

but I want Group by errors.

I want that instead because there could be volume before the line.start_date so instead I want to use whatever is the first date that posted volume using the gb.date field.

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-04-27 : 18:03:14
Unfortunately, I do not understand what you are trying to do. Here is a link that might help you refine your question as well as how to provide DDL, DML and Expected Output:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -