http://www.mysql.com/documentation/mysql/bychapter/manual_Tutorial.html#Work
ing_with_NULL
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Con
trol_flow_functions




Regards,
Daniel Kushner
_________________________________________
Need hosting? http://thehostingcompany.us


-----Original Message-----
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 9:37 PM
To: PHP General
Subject: [PHP] MySQL Query - Not PHP Specific


I know this isn't a PHP question per se, but it does relate to PHP
development.

Every day I work with MySQL as my PHP database, I become more dissalusioned
with its ability as a database server. Yes its fast, but its missing so many
useful features of other DB servers. I'm digressing...


Is there a functional equivelent of SQL Servers ISNULL() command? (Yes I am
aware of the MySQL ISNULL command and it is different)

Hrm.. I just found a solution...

SQL Server ISNULL takes two arguments, CheckField, And ReplacementValue
SELECT ISNULL(t.Task, 0) FROM Users u LEFT JOIN Tasks t ON t.UserID =
u.UserID;

instead of returning <NULL> where a Userid has no tasks, it would return 0.

The equivelent function in MySQL is COALESCE(Field, <ReplaceValue>)

I'm not sure it was meant for that usage, but it does work none the less.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to