Re: no IF - am I missing something ?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: no IF - am I missing something ?
Дата
Msg-id 20050321075049.GA18302@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: no IF - am I missing something ?  (Thomas F.O'Connell <tfo@sitening.com>)
Список pgsql-general
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 might be somewhat less syntactic sugar, but this is not a five
> line expression and, to me, is more readable than a comma-delimited
> list where position alone indicates function in the expression.

CASE is also standard SQL, whereas IF isn't (unless I've overlooked
it in the SQL:2003 draft).

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

В списке pgsql-general по дате отправления:

Предыдущее
От: Alexander Ivanko
Дата:
Сообщение: Test
Следующее
От: Alexander Ivanko
Дата:
Сообщение: PostgreSQL v7.4.7 support platform?