Ted Roche <> wrote: > On 7/12/07, Kevin Cully <[EMAIL PROTECTED]> wrote: > >> SELECT cType, nItemTotal, CASE WHEN UPPER(cType)='EXPENSE', THEN >> nItemTotal ELSE 0.0 END as nExpTotal FROM MySchema.MyTable WHERE >> dCreate >>> = current_date - 365 ORDER BY cType > > > No, that's fugly. I'd change it to: > > SELECT cType, nItemTotal, nItemTotal as nExpTotal FROM > MySchema.MyTable WHERE dCreate >= current_date - 365 AND > UPPER(cType)='EXPENSE' UNION > SELECT cType, nItemTotal, 000000.00 as nExpTotal FROM > MySchema.MyTable WHERE dCreate >= current_date - 365 AND UPPER(cType) > !='EXPENSE' ORDER BY cType
Way to go Ted. Union is your friend in situations like this. Stephen Russell DBA / .Net Developer Memphis TN 38115 901.246-0159 "A good way to judge people is by observing how they treat those who can do them absolutely no good." ---Unknown http://spaces.msn.com/members/srussell/ No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.10.8/904 - Release Date: 7/16/2007 5:42 PM _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.