#眉標=MySQL、ifnull、nullif #副標=MySQL Server開發應用(8) #大標=實作SQL條件分析 #作者=文/圖 葉建榮 ==<反灰>=========== case when 條件1 then 回傳結果1 [when 條件2 then 回傳結果2] [else回傳結果3] end ================ ==<反灰>=========== select case when unitprice>15 then '>15' when unitprice>10 then '>10' end as unitprice1,unitprice from products; ================ ==<反灰>=========== select case when unitprice>10 then '>10' when unitprice>15 then '>15' end as unitprice1,unitprice from products; ================ ==<反灰>=========== select case when unitprice>15 then '>15' when unitprice>10 then '>10' else '<=10' end as unitprice1,unitprice from products; ================