SELECT I.Brand as 品牌,I.Type as 规格,S.num as 库存,S.Price as 库存均价,
B.lastNum as 最后入库数,B.lastPrice as 最后入库价 from
a I, c B,b S
where I.id = B.id and I.id = S.id and LEFT(B.No,2)='CG'
and T.Brand <> '' and T.num >0
and B.No=(select max(No) from c where c.id=B.id)
ORDER BY T.Brand asc,T.Type asc