为什么in嵌套循环查询结果不同?

lumengabc 2013-04-10 03:50:09
为什么in嵌套循环查询结果不同?

mysql> select count(*) from goods
-> where goodsid
-> in(SELECT goodsid FROM goodsatt WHERE cid=200);
+----------+
| count(*) |
+----------+
| 169039 |
+----------+
1 row in set (7.00 sec)

mysql> select count(*) from goods a,goodsatt b
-> where (a.goodsid=b.goodsid and b.cid=200);
+----------+
| count(*) |
+----------+
| 172083 |
+----------+
1 row in set (2.63 sec)
...全文
78 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
WWWWA 2013-04-10
  • 打赏
  • 举报
回复
A表中应该有重复的记录,检查一下

56,685

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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