22,302
社区成员




select * from Weigh
select * from InStoreSub
select a.InNo,a.WeighNo,a.PartID,a.PartName,b.FullName from InStoreSub a,Weigh b where a.WeighNo=b.WeighNo
SELECT
a.InNo,
a.WeighNo,
a.PartID,
a.PartName,
b.FullName
FROM InStoreSub a
INNER JOIN Weigh b ON a.WeighNo=b.WeighNo
--写法1:
select a.InNo,a.WeighNo,a.PartID,a.PartName
,FullName=(select top 1 FullName from Weigh where WeighNo=a.WeighNo)
from InStoreSub a
--写法2:
select a.InNo,a.WeighNo,a.PartID,a.PartName,b.FullName from InStoreSub a,
(select distinct WeighNo,FullName from Weigh) b
where a.WeighNo=b.WeighNo
--写法3:
select distinct a.InNo,a.WeighNo,a.PartID,a.PartName,b.FullName from InStoreSub a,Weigh b where a.WeighNo=b.WeighNo