Re: [GENERAL] no IF - am I missing something ?

2005-03-21 Thread Harald Fuchs
In article [EMAIL PROTECTED], Michael Fuhr [EMAIL PROTECTED] writes: On Mon, Mar 21, 2005 at 12:35:22AM -0600, Thomas F.O'Connell wrote: The number of lines depends merely on where you place your line breaks. IF(days_complete = 120, job_price, 0)AS Days_120 could be written as: CASE

[GENERAL] no IF - am I missing something ?

2005-03-20 Thread Richard Crawley
Hello all. In the tail end of converting an app from MySQL to psql. I have this code : snip IF(days_complete = -120, job_price,0) AS Days_120, IF(days_complete BETWEEN -119 AND -90, job_price,0) AS Days_90, IF(days_complete BETWEEN -89 AND -60, job_price,0) AS Days_60, IF(days_complete BETWEEN -59

Re: [GENERAL] no IF - am I missing something ?

2005-03-20 Thread Thomas F . O'Connell
The number of lines depends merely on where you place your line breaks. IF(days_complete = 120, job_price, 0)AS Days_120 could be written as: CASE WHEN days_complete = 120 THEN job_price ELSE 0 END AS Days_120 There might be somewhat less syntactic sugar, but this is not a five line expression

Re: [GENERAL] no IF - am I missing something ?

2005-03-20 Thread Michael Fuhr
On Mon, Mar 21, 2005 at 12:35:22AM -0600, Thomas F.O'Connell wrote: The number of lines depends merely on where you place your line breaks. IF(days_complete = 120, job_price, 0)AS Days_120 could be written as: CASE WHEN days_complete = 120 THEN job_price ELSE 0 END AS Days_120 There