SQL query error:SELECT count(*) FROM MstProduct p ,MstProdCat c,V_MstProdCat cat,MstColor cl,MstMaker mk,MstProductRank rk , MstMaterial Mrl, (select ProductID,SUM(QtyCur) AvailableQty from (select ProductID,AvailableQty QtyCur from PrgStock Union select ProductID,ifnull(-Qty,0) QtyCur from PrgCartDetail where cartno = '') B group by ProductID) PST, (SELECT p1.ProductId,pp2.SeqNo,pp2.PictNameO,pp2.PictNameS,pp2.PictNameL,pp2.FileUpFlag,pp2.DelFlag FROM MstProduct p1 LEFT OUTER JOIN MstProductPict pp2 ON p1.ProductId=pp2.ProductId) pic WHERE p.ProdCat=c.ProdCatID and c.ProdCatID = cat.ProdCatID and ifnull(p.Color,0)=cl.ColorID and p.ProdMaker=mk.MakerID and ifnull(p.Material,0)=Mrl.MaterialID and ifnull(p.RankCur,1)=rk.RankID and p.ProductID=PST.ProductID and p.ProductID=pic.ProductID and ifnull(pic.Seqno,1) = 1 and PST.AvailableQty > 0 and p.DelFlag=0 and NetStatus =1 and p.ProductID not like '9%' AND ProdCatGrpNo = 5 AND ProdCatMdlNo = 18 ORDER BY PriceUnit ASC,p.ProductID ASC  Tomizawa-Product List

Japanese Japanese Englist English Thai Thai