date_format(date,'%H') = 8 and date_format(date,'%i') = 30 SELECT * FROM `t_pda_trucklog` WHERE DATE_FORMAT(operatetime,'%H') = 9 AND DATE_FORMAT(operatetime,'%i') = 42 AND DATE_FORMAT(operatetime,'%s') = 12 http://www.w3school.com.cn/sql/fu
MySQL查询时使用LIKE匹配下划线,您会发现连查询“%A_B%”时会出现“%A B%”和“%AB%”也查询出来了,这是因为下划线也被当作特殊字符,做了任意匹配转换了,所以,要想匹配下划线,那么就需要“转义”一下.转义的方法有如下(示例想查询A_B匹配字段). 一.使用Escape转义 示例: SELECT * FROM mytable WHERE col LIKE '%A#_B%' ESCAPE '#'; 或, SELECT * FROM mytable WHERE col LIKE '%A
不说废话,贴代码: CREATE OR REPLACE FUNCTION to_time(sec IN NUMBER) RETURN VARCHAR2 IS /*把秒转成时分秒格式 auth lzpong 201/09/16 */ BEGIN ))), ,); EXCEPTION WHEN OTHERS THEN RETURN '0:00:00'; END to_time; CREATE OR REPLACE FUNCTION isnumeric(str IN VARCHAR2) RETURN