SELECT COUNT(*) AS GNUM FROM D_Goods INNER JOIN D_Company ON D_Goods.GoodsCompanyNo = D_Company.CompanyNo LEFT JOIN M_LargeClass AS Large1 ON D_Goods.GoodsLargeClassNo1 = Large1.LargeClassNo LEFT JOIN M_MediumClass AS Medium1 ON D_Goods.GoodsLargeClassNo1 = Medium1.MediumClassLargeClassNo AND D_Goods.GoodsMediumClassNo1 = Medium1.MediumClassNo LEFT JOIN M_SmallClass AS Small1 ON D_Goods.GoodsLargeClassNo1 = Small1.SmallClassLargeClassNo AND D_Goods.GoodsMediumClassNo1 = Small1.SmallClassMediumClassNo AND D_Goods.GoodsSmallClassNo1 = Small1.SmallClassNo LEFT JOIN M_LargeClass AS Large2 ON D_Goods.GoodsLargeClassNo2 = Large2.LargeClassNo LEFT JOIN M_MediumClass AS Medium2 ON D_Goods.GoodsLargeClassNo2 = Medium2.MediumClassLargeClassNo AND D_Goods.GoodsMediumClassNo2 = Medium2.MediumClassNo LEFT JOIN M_SmallClass AS Small2 ON D_Goods.GoodsLargeClassNo2 = Small2.SmallClassLargeClassNo AND D_Goods.GoodsMediumClassNo2 = Small2.SmallClassMediumClassNo AND D_Goods.GoodsSmallClassNo2 = Small2.SmallClassNo LEFT JOIN M_LargeClass AS Large3 ON D_Goods.GoodsLargeClassNo3 = Large3.LargeClassNo LEFT JOIN M_MediumClass AS Medium3 ON D_Goods.GoodsLargeClassNo3 = Medium3.MediumClassLargeClassNo AND D_Goods.GoodsMediumClassNo3 = Medium3.MediumClassNo LEFT JOIN M_SmallClass AS Small3 ON D_Goods.GoodsLargeClassNo3 = Small3.SmallClassLargeClassNo AND D_Goods.GoodsMediumClassNo3 = Small3.SmallClassMediumClassNo AND D_Goods.GoodsSmallClassNo3 = Small3.SmallClassNo INNER JOIN M_Style ON D_Goods.GoodsStyleNo = M_Style.StyleNo LEFT JOIN M_ServiceItem ON M_ServiceItem.ServiceItemServiceKindNo = D_Goods.GoodsServiceKindNo AND M_ServiceItem.ServiceItemNo = D_Goods.GoodsServiceItemNo LEFT JOIN (SELECT GoodsQAPCompanyNo, GoodsQAPGoodsNo, COUNT(*) AS QAPCnt FROM D_GoodsQAP GROUP BY GoodsQAPCompanyNo, GoodsQAPGoodsNo ) D_GoodsQAP ON D_Goods.GoodsCompanyNo = GoodsQAPCompanyNo AND D_Goods.GoodsNo = GoodsQAPGoodsNo WHERE D_Goods.GoodsEnable = 1 AND D_Company.CompanyCode = 00553 AND D_Goods.GoodsCode = Z00001
1054: Unknown column 'Z00001' in 'where clause'