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

Reply via email to