刚学习SQL;直接用大牛的mysql 和 sqlite都没通过。在启发下写了这个: select * from employees where hire_date in ( select h1 from ( (select distinct hire_date h1 from employees) a join (select distinct hire_date h2 from employees) b )t where h1 < h2 group by h1 having count(*) = 2) 测试已过。 但可能仍有应优化之处,欢迎大家讨论。
点赞

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务