RE: [NF] PostgreSQL :: IIF?

2007-07-16 Thread Stephen the Cook
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

[NF] PostgreSQL :: IIF?

2007-07-12 Thread Kevin Cully
I'm trying convert a VFP SQL Select statement over to run under PostgreSQL, and I'm not finding the replacement for IIF. Any tips? -Kevin CULLY Technologies, LLC Sponsor of FoxForward 2007 foxforward.net ___ Post Messages to: ProFox@leafe.com

Re: [NF] PostgreSQL :: IIF?

2007-07-12 Thread Ed Leafe
On Jul 12, 2007, at 1:55 PM, Kevin Cully wrote: I'm trying convert a VFP SQL Select statement over to run under PostgreSQL, and I'm not finding the replacement for IIF. Any tips? Use the CASE structure: http://pgsqld.active-venture.com/functions-conditional.html#AEN9698 -- Ed Leafe

Re: [NF] PostgreSQL :: IIF?

2007-07-12 Thread Kevin Cully
Grrr. I found something right after sending the email ... but can this be the best solution? 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 -Kevin CULLY Technologies,

Re: [NF] PostgreSQL :: IIF?

2007-07-12 Thread Ted Roche
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,