多个Left Outer Join的sql语句如何写
西雀 2005-10-13 12:14:10 我要做一个查询, 有五张表, 一张是主表, 对其它的表做 left outer join 查询,下面的语句在InterBase中查询是没问题的,可我不知道在VB中该怎么写?
Select goods.id,goods.number as uunumber,goods.name as name,sum(detailcheck.number) as xssl,sum(detailcheck.price*detailcheck.number) as zqje,sum(detailcheck.je) as xsje,sum(detailcheck.ml) as ml,sum(detailcheck.je)-sum(detailcheck.ml) as xscb From maincheck left outer join detailcheck on ( maincheck.id=detailcheck.checkid) left outer join customer on (maincheck.customerid=customer.id) left outer join store on (maincheck.jhstoreid=store.id or maincheck.chstoreid=store.id) left outer join employee on (maincheck.agentid=employee.id) left outer join goods on (detailcheck.goodsid=goods.id) where ifcheck='true' and ifrollback='false' And maincheck.djtype='零售单' group by goods.number,goods.name,goods.id