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 和 date。
我想给它一个 id,它会找到列 id 的起息日的所有重复项。
例子:
id |date 1 |2013-09-16 2 |2013-09-16 3 |2013-09-23 4 |2013-09-23
我想给它 id 1(不提供有关日期的任何信息),它会给我一个包含 2 列的表格,列出 id 1 日期的重复项
提前致谢!
select * from your_table where `date` in ( select `date` from your_table where id = 1 )
或者如果你喜欢使用连接
select t.* from your_table t inner join ( select `date` from your_table where id = 1 ) x on x.date = t.date