MySQL Query - Not PHP Specific

From: Date: Thu, 16 Jan 2003 02:37:22 +0000
Subject: MySQL Query - Not PHP Specific
Groups: php.general 
Request: Send a blank email to php-general+get-131801@lists.php.net to get a copy of this message
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.

« previous php.general (#131801) next »