想筛选出table1在table2中相应月份只包含table2中的ID的记录,生成的结果是table3,用MySQL怎么写呢?
6条回答 默认 最新
- Kevin.Y.K 2019-11-13 11:22关注
select t1.* from table1 t1 where exists ( select 1 from table2 t2 where t1.id = t2.id and date_format(t1.date, '%Y%m') = date_format(t2.date, '%Y%m') )
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报