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.
Author |
Topic |
omega1983
Starting Member
40 Posts |
Posted - 2010-08-07 : 18:51:55
|
sum(case when a.coreid=b.coreid and b.giftacctdv = '12' and b.gifteffdat between '7/1/2009'and '6/30/2010' then b.giftlinetotal else 0 end) as FY10,sum(case when a.coreid=b.coreid and b.giftacctdv = '12' and b.gifteffdat between '7/1/2008'and '6/30/2009'then b.giftlinetotal else 0 end) as FY09,If the FY10 is >0 then I want to establish a column called 'GAVELASTYEAR' and mark it 'Y'If the FY09 is >0 and FY10 = 0 then I want to establish a column called 'GAVESOMEYEAR' and mark it 'Y'. However if both FY09 and FY10 are >0 then only FY10 should be marked, not both. Essentially FY10 determines whether FY09 will get a mark. How can I accomplishe this |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-08-07 : 19:58:40
|
can show some example ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-09 : 04:58:15
|
Seems that you have tried to access alias column directly. Use a derived table and do checkingMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|