| List: | General Discussion | « Previous MessageNext Message » | |
| From: | (Hal | Date: | April 26 2011 3:32am |
| Subject: | RE: WHERE does not work on calculated view field - Found word(s) list error in the Text body | ||
| View as plain text | |||
>>>> 2011/04/25 18:45 +0000, Larry McGhaw >>>>
CREATE VIEW `myview2` AS
SELECT a.*, IF(b.`Name` IS NULL, '', b.`Name`) AS `TypeName`
FROM `mytable` a
LEFT JOIN `types` b ON a.`Type` = b.`ID`;
<<<<<<<<
Well, for this construct
IF(b.`Name` IS NULL, '', b.`Name`)
there is a special function IFNULL:
IFNULL(b.`Name`, '')
It has the same special type-treatment that IF has.
I quite often use it.
