日期:2014-05-17 浏览次数:20407 次
select a.goodid,a.goodnum ,
case when b.price is null then 0.00 else b.price end as price
from
(select goodid, shopid ,goodnum from shopgoods where shopid=1 and goodnum<20) a
left join whogoods b on a.goodid = b.goodid and b.whoid = 1
select a.goodid,b.goodname,isnull(c.price,0) price from shopgoods a join goods b on a.goodid=b.goodid
left join whogoods c on a.goodid=c.goodid
where a.shopid=1 and c.whoid=1