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

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, n

Re: [NF] PostgreSQL :: IIF?

2007-07-12 Thread Kevin Cully
I was afraid that you were going to say that.Thanks. -Kevin CULLY Technologies, LLC Sponsor of FoxForward 2007 foxforward.net Ed Leafe wrote: > Use the CASE structure: > > http://pgsqld.active-venture.com/functions-conditional.html#AEN9698

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, L

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