Sorry about the delay, I am not real familiar with sub-selects. Could you give me a example/sample of what you are suggesting?
-----Original Message----- From: Sark, Ron Sent: Thursday, February 17, 2005 10:52 AM To: SQL Subject: Re: Using CASE statements > The output should basically be a cross tab without the dates being > used as part of the selection. the where statement > in the SQL would be similar to WHERE (((If(DateC >= Datea, DateC, > Datea)) I basically want to use the datec if datec is >= datea else > use the default datea between dateb. Is it possible to do a (Where > IF(..then else.)? > > fielda fieldb fieldc fieldd > 1 data1 1 00.00 > 1 data2 34 15.00 > 2 data1 13 16.00 > 2 data2 35 850.00 > > -----Original Message----- > From: Adam Haskell [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 01, 2005 10:59 AM > To: SQL > Subject: Re: Using CASE statements > > > couldn't you do a sub select there like (Select count(distinct fc) > From table Where date = '1/31/2004') as dailyamount > > > Adam H > > On Tue, 01 Feb 2005 07:24:54 -0400, Jochem van Dieten > <[EMAIL PROTECTED]> wrote: > > Sark, Ron wrote: > > > Syntax to be translated - where IF(datea >=datec), use datec, else > use > > > datea (see bold conditions on line 4) > > > > CASE WHEN datea >= datec THEN datec ELSE datea END > > > > > > > 2 Count(distinct case when datea = '01/31/2005' then a.fc else > null > > > end) as dailyamount > > > > COUNT (DISTINCT ... is not standard SQL, so I can't really help you > without more information on what it is supposed to return. > > > > Jochem > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2130 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=89.70.6 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
