mysql like多个
比如需要这样的效果:
select * from user where name like '%四%' or name like '%五%'
可以使用 REGEXP 写成:
select * from user where name regexp '四|五'
string sql = $@"SELECT ANY_VALUE(t.Id) AS Id,ANY_VALUE(t.JobId) AS JobId,
ANY_VALUE(t.PushMessage) AS PushMessage,
ANY_VALUE(t.OperatingTime) AS OperatingTime,
ANY_VALUE(t.PushDataTypeId) AS PushDataTypeId
FROM
(
SELECT push.* FROM Tec_PushYhWebLog push
INNER JOIN
(
SELECT log3.JobId FROM Tec_PushYhWebLog log1
INNER JOIN Tec_PushYhWebLog log3 ON log3.JobId = log1.JobId
WHERE log1.PushDatatypeId = {PushDataTypeEnum.Job.Id} AND log1.PushStateId = {PushStateEnum.Success.Id}
AND log3.PushDatatypeId IN ({PushDataTypeEnum.Cost.Id},{PushDataTypeEnum.CancleCost.Id})
AND log3.PushStateId in({PushStateEnum.Wait.Id}, {PushStateEnum.PushIng.Id}, {PushStateEnum.Failed.Id})
GROUP BY log3.JobId
HAVING (COUNT(IF(log3.PushStateId IN({PushStateEnum.PushIng.Id}, {PushStateEnum.Failed.Id}),1,NULL)) < 1)
LIMIT @groupCount
) pushCopy ON pushCopy.JobId = push.JobId
WHERE push.PushDatatypeId IN ({PushDataTypeEnum.Cost.Id},{PushDataTypeEnum.CancleCost.Id})
AND push.PushStateId in({PushStateEnum.Wait.Id})
-- 为了取分组后最大最小时间一整条
HAVING 1 ORDER BY push.CreateTime ASC
) t
GROUP BY t.JobId";