On Wednesday, September 26, 2001, at 02:48  AM, [EMAIL PROTECTED] 
wrote:

>
>
>
>
>
>
> Steve Cayford <[EMAIL PROTECTED]> on 25/09/2001 17:28:57
>
>
>
> To:   [EMAIL PROTECTED]
> cc:   [EMAIL PROTECTED], [EMAIL PROTECTED]
> Subject:  Re: [PHP] Getting my head around nulls
>
>
> On Tuesday, September 25, 2001, at 10:30  AM, [EMAIL PROTECTED]
> wrote:
>
>>>
>>> Just had a look at manual, ifnull() seems close to useless.  However 
>>> if
>>> they had NVL(), as Oracle douse....
>>>
>>> NVL( column|litrel, '*null*' )
>>>
>>> This takes a column or literal as its first arg and if arg is null
>>> returns
>>> 2nd arg otherwise returns arg.  In other words if the column is null 
>>> it
>>> is
>>> replaces by arg2 otherwise it is simply returned.
>>>
>>
>> Um, that's what ifnull() does. At least it works for me.
>>
>> -Steve
>
> Verry true, sorry, was looking at nullif.  Also noticed the if function,
> can this have more than three parameters.  i.e
>
> if ( col, 'A', 'Accept', 'C', 'Complete', 'Unknown' )
>
> like Oracle decode. and if elseif else structure.
>
> Neb
>

Looks like you want the CASE statement. I haven't used it but it looks 
pretty much like what you're asking.

CASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN 
result ...] [ELSE result] END

Guess this discussion should really be on php-db :)

-Steve

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to