sql 语句求助(关联表做视图)

2024-12-29 14:26:16
推荐回答(2个)
回答1:

select d.UserID as ConsignUserID,c.UserID as DealUserID from @a c
join
( select * from @a a
join @b b on a.CompanyID=b.ConsignID
) d on c.CompanyID=d.DealID

回答2:

select a1.userid,a2.userid from a a1, a a2, b where a1.companyid=b.consignid and a2.companyid=b.dealid