问一个SQL查询问题

stan23 2006-11-11 02:05:24
1."select c2 from table1 where c1=1"
2."select c2 from table1 where c1=2"
想看看1,2的结果中有没有相同的数据,怎样用一条SQL语句做到呢?
...全文
182 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
stan23 2006-11-11
  • 打赏
  • 举报
回复
谢谢两位,已经解决!
懒得去死 2006-11-11
  • 打赏
  • 举报
回复
select count(*) from
table1 a, table1 b
where a.c2=b.c2 and a.c1=1 and b.c1=2;
helloyou0 2006-11-11
  • 打赏
  • 举报
回复
select count(*) from
table1 a, table1 b
where a.c2=b.c2 and a.c1=1 and b.c1=2;

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧