菜鸟!一句select语句不明白,想不通!

ballatong 2004-12-23 02:33:39
有两张表:table1

sc
B4B037900
B4B077800
B4B083000
B4B083100

table2

ordno
B4B037900
B4B077800
B4B083000
B4B083100
---------------------
用语句


select * from table1 a INNER JOIN

table2 c ON a.ordno = c.sc#



请问产生的结果为什么是 13行!


B4B037900
B4B077800
B4B037900
B4B077800
B4B083000
B4B083100
B4B083000
B4B083000
B4B083100
B4B037900
B4B077800
B4B083000
B4B083100

------------应该4行才对啊!

...全文
122 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ballatong 2004-12-23
  • 打赏
  • 举报
回复
那就奇怪了 我的返回13行!
火电 2004-12-23
  • 打赏
  • 举报
回复
是啊
select * from table2 a INNER JOIN

table1 c ON a.ordno = c.sc#
是标准的join写法



select a.*
from table1 a , table2 b
where a.sc =b.ordno

是从前的join写法
都没有问题
didoleo 2004-12-23
  • 打赏
  • 举报
回复
同意楼上,就是返回四行嘛,哪来的13行?
hzwm 2004-12-23
  • 打赏
  • 举报
回复
结果应该是四行,没错。

select a.*
from table1 a , table2 b
where a.sc =b.ordno
vinsonshen 2004-12-23
  • 打赏
  • 举报
回复

select * from table2 a INNER JOIN

table1 c ON a.ordno = c.sc
vinsonshen 2004-12-23
  • 打赏
  • 举报
回复
select a.ordno,c.sc from table2 a INNER JOIN

table1 c ON a.ordno = c.sc#
ballatong 2004-12-23
  • 打赏
  • 举报
回复
select * from table2 a INNER JOIN

table1 c ON a.ordno = c.sc#

34,588

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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