select a.channel_id,channel_code,site_name,siteid,refer_channel,substring_index(substring_index(a.url,';',b.help_topic_id+1),';',-1) as urls from t_channel_mapping a join mysql.help_topic b on (length(a.url) - length(replace(a.url,';',''))+1) > b.help_topic_id;
from
(
select (@rownum:=0),a.product
from
(select product from t_proudct_info GROUP BY product) a
) t
from (
select siteid,refer_channel,url from t_channel_mapping order by siteid,refer_channel,url
) t group by siteid,refer_channel
20080808222301
MySQL Str to Date (字符串轉換爲日期)函數:str_to_date(str, format)
select str_to_date('08/09/2008', '%m/%d/%Y'); -- 2008-08-09
select str_to_date('08/09/08' , '%m/%d/%y'); -- 2008-08-09
select str_to_date('08.09.2008 08:09:30', '%m.%d.%Y %h:%i:%s'); -- 2008-08-09 08:09:30
date_add()函數向日期添加指定的時間間隔。
DATE_ADD(OrderDate,INTERVAL 2 DAY)
DATE_ADD(OrderDate,INTERVAL -2 MONTH)
DATEDIFF() 函數返回兩個日期之間的天數。
SELECT DATEDIFF('2008-12-30','2008-12-29') AS DiffDate