Hi,
I am attempting to put section A and B together in one statement while using 
the case function. Any ideas?
    Syntax to be translated - where IF(datea >=datec), use datec, else use 
datea (see bold conditions on line 4)
 
SECTION A 
1 Select a.fa, b.fa, a.fb, count(distinct a.fc) as fccount, sum(a.fd) as 
fdamount,
2 Count(distinct case when datea = '01/31/2005' then a.fc else null end) as 
dailyamount
3 from filea as a inner join fileb as b on ...matching conditions
4 where datea >= datec and datea >= '01/01/2005' and datea <= '01/31/2005' and 
condition and condition and condition and fieldH in (COL1','COL2,'COL3','COL4')
5 Group by a, b, c
6 Order by a, b, c
 
SECTION B
1 Select a.fa, b.fa, a.fb, count(distinct a.fc) as fccount, sum(a.fd) as 
fdamount,
2 Count(distinct case when datea = '01/31/2005' then a.fc else null end) as 
dailyamount
3 from filea as a inner join fileb as b on ...matching conditions
4 where datea >= '01/01/2005' and datea <= '01/31/2005' dateb and condition and 
condition and condition and fieldH in (COL1','COL2,'COL3','COL4')
5 Group by a, b, c
6 Order by a, b, c
 
Thanks,
    Ron
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase RoboHelp from House of Fusion, a Macromedia Authorized Affiliate and 
support the CF community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=59

Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2104
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to