Re: Getting my head around nulls
| From: | Steve Cayford | Date: | Wed, 26 Sep 2001 14:32:56 +0000 |
| Subject: | Re: Getting my head around nulls | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68868@lists.php.net to get a copy of this message | ||
On Wednesday, September 26, 2001, at 02:48 AM, Ben.Edwards@chase.com wrote:
Steve Cayford <steve_cayford@unioncab.com> on 25/09/2001 17:28:57 To: Ben.Edwards@chase.com cc: kjohnson@zootweb.com, php-general@lists.php.net Subject: Re: [PHP] Getting my head around nulls On Tuesday, September 25, 2001, at 10:30 AM, Ben.Edwards@chase.com wrote: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 :) -SteveVerry 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. NebJust 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