字符串多次替换:(替换了四次)
SELECT
REPLACE(REPLACE(REPLACE(REPLACE(
T5,
substring(
T5,
LOCATE(‘&timeStamp‘, T5),
24
),
‘‘
),substring(
T5,
LOCATE(‘&accessSignature‘, T5),
47
),‘‘),substring(
T5,
LOCATE(‘&time_stamp‘, T5),
25
),‘‘),substring(
T5,LOCATE(‘&access_signature‘, T5),
48
),‘‘)
as temp
FROM
v2-api-log
REPLACE(列,要被替换的字符串,替换成为的字符串)
七日排重:
CREATE TABLE new_table (
SELECT
t1.*
FROM
tmp_table t1
JOIN tmp_table t2 ON t1.temp = t2.temp
AND t1.T1 = t2.T1
AND t1.T6 != t2.T6
WHERE
abs(DATE(t1.daytemp) - DATE(t2.daytemp)) <= 7
GROUP BY t1.T5)
需求是排重,之后按照两个重复数据的时间是否在七日之内,如果在七日之内就算重复,如果不在就不算。
思路是一张表当两张表关联查询