数据库中两张表,表aa 有两列 boxid 和 sn ,其中一个boxid对应多个sn, sn是唯一的,在另一张表bb 中item ,wonum ,sn三列,我现在要根据boxid查出aa中的sn,然后将bb中的sn对应的item,wonm显示出来sql 语句如下
Select a.*,b.Item,b.WoNum From aa a inner join bb b on a.BoxID = 'Wo_box_2' and b.sn=(select sn from aa)
报错为:Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
请问sql语句该怎么写??????
Select a.*,b.Item,b.WoNum From aa a inner join bb b on a.BoxID = 'Wo_box_2' and b.sn=(select sn from aa)
报错为:Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
请问sql语句该怎么写??????
inner join bb b on a.BoxID = 'Wo_box_2'
and b.sn=a.sn
这样就可以了
From aa a inner join bb b
on a.BoxID = 'Wo_box_2' and a.sn = b.sn
回答的第一个,第二个,我写错了,看第三个,