解决需求用到的一些sql特殊语法啦,记录一下 ,耶
自定义 order by
order by
(CASEWHEN order_name ='美' THEN'1'WHEN order_name ='鹅' THEN'2'WHEN order_name ='小' THEN'3'ELSE
nullEND);-- -----------------------------------------------------------------------------------------
编码转换
CONVERT(date_sub(v_date,interval 1 day) USING utf8) COLLATE utf8_unicode_ci;
-- -----------------------------------------------------------------------------------------
OR 和 AND
表示或的正确写法 ,括号是必须要有的
AND (
cs.INVOICE_TITLE LIKE '%12%' OR cs.CLIENT_NAME LIKE '%12%')