22,210
社区成员
发帖
与我相关
我的任务
分享
select a.id,a.user_no,a.product_tc,b.statu price
from a,b
where a.product_tc = b.product_tc
select a.* , b.price from a , b where a.product_tc = b.product_tc
select A.*,B.price
from A left join B on A.product_tc =B.product_tc
select a.*,b.price from a ,b where a.product_tc= b.product_tc
select
a.*,b.price
from
a left join b
on
a.id=b.id
select A.* ,B.price
from A
left join B on A.product_tc = B.product_tc
select a.id,a.user_no,a.product_tc,b.statu price
from a,b
where a.product_tc = b.product_tc
----try
declare @A table (id int,user_no int,product_tc nvarchar(10),statu int)
insert into @A select 1,2,'ab',1
union all select 2,2,'cd',1
union all select 3,3,'ab',2
union all select 4,3,'cd',2
union all select 5,2,'el',1
declare @B table (id int,product_tc nvarchar(10),price int)
insert into @B select 1,'ab',50
union all select 2,'cd',20
union all select 3,'el',35
select a.id,a.user_no,a.product_tc,a.statu,b.price from @A a join @B b
on a.product_tc=b.product_tc