SELECT distinct(query_time) `Result` FROM `slow_log` WHERE `db` LIKE 'taco_query' and query_time > '00:00:00'
我假设您需要获得distinct查询时间,您可以直接使用distinct关键字而不是UNION。
如果要排除时间“00:00:00”、“01:00:00”、“05:00:00”。。然后可以将它们添加到NOT in操作符中。
SELECT distinct(query_time) `Result` FROM `slow_log` WHERE `db` LIKE 'taco_query' and query_time > '00:00:00' and query_time NOT IN ('00:00:00', '01:00:00', '05:00:00',...)