【发布时间】:2012-03-05 10:57:03
【问题描述】:
我有一个时间日志表,其中所有条目都带有时间戳和事件。
现在我想选择特定事件之后的所有行和该事件之前(ORDER BY time_stamp)的一行。
我可以通过多个查询轻松实现这一点,但是只有一个查询可以吗?
使用多个查询
SELECT time
FROM table
WHERE event LIKE '%event_to_fint%'
SELECT event
FROM table
WHERE time<'time from last query'
LIMIT 1
ORDER BY
time DESC
【问题讨论】:
-
您能否发布您的多个查询
-
SELECT time FROM table WHERE event LIKE '%event_to_fint%'
+ SELECT event FROM table WHERE time 并结合