mysql case statement

From: Date: Sun, 27 Jun 2010 08:08:24 +0000
Subject: mysql case statement
Groups: php.general 
Request: Send a blank email to php-general+get-306458@lists.php.net to get a copy of this message
Hello, how to select only if value is present? $query = $db->query("select menus.id, menus.name, case when panels.id is not null then '1' end as hiddenpanel from " . \DB_MENUS . " as menus left join " . \DB_HIDDENPANELS . " as panels on (menus.id = panels.menu_id) where menus.id='" . (int)$id . "' "); i would like to select hiddenpanel only if there is a corresponding value in DB_HIDDENPANELS. At the moment i get NULL if there is no corresponding value in HIDDENPANELS table! Br Tanel

« previous php.general (#306458) next »