Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张桌子,看起来像:
id batch_id start_ts stop_ts
我想选择昨天开始的那些 id(可以通过给出 start_ts > .. AND start_ts < .. 轻松完成)并在表中有另一个 id 与该 id 的 batch_id 相同的 batch_id 并且该 id 昨天结束。
构建这个 MySQL 查询的好方法是什么?
关于什么 ...
select <field list> from table t1 join table t2 on t1.id = t2.batch_id where start_ts between <date 1> and <date 2>