日期:2014-05-18 浏览次数:20754 次
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