2 neil1225 neil1225 于 2016.05.05 18:10 提问

怎么样实现图表的显示!这个sql什么意思呀!

String sql="select A.P_DATE,'采购入库' as CGTYPE,sum(A.P_NUMBER) AS P_NUMBER,sum(A.Z_PRICE) AS Z_PRICE,C.PROVNAME,"
+" CASE F.PRODLEVEL WHEN '1' THEN '原厂' WHEN '2' THEN '正厂' WHEN '3' THEN '副厂' WHEN '4' THEN '品牌' WHEN '5' THEN '拆车件' END AS PRODLEVEL,"
+" CONCAT(I.className,'->',H.className,'->',g.className) as CLASSNAME,F.NO,F.PRODNAME,F.OENO"
+" FROM "
+" (select left(A.P_DATE,7) AS P_DATE ,A.ID,'采购入库' as CGTYPE,B.P_NUMBER,B.P_PRICE,B.Z_PRICE,B.P_WARES_ID,A.P_SUPPLIER_ID,A.D_STORAGE_ID,B.LOCATION_ID,A.P_TYPE,A.AUDIT_STATUS,A.COMPANY_ID"
+" from jxc_t_purchase A"
+" left join jxc_t_purchase_detail B on A.ID=B.P_PURCHASE_ID"
+" UNION"
+" select left(C.TIME,7) AS P_DATE,C.ID,'采购退货' as CGTYPE,D.NUM AS P_NUMBER,D.PRICE AS P_PRICE,D.NUM*D.PRICE AS Z_PRICE,"
+" D.PRODUCTS_ID AS P_WARES_ID,C.P_SUPPLIER_ID,C.STORAGE_ID AS D_STORAGE_ID,D.LOCATION_ID,'0' AS P_TYPE,C.AUDIT_STATUS,C.COMPANY_ID"
+" from jxc_t_purchasing_return C"
+" left join jxc_t_purchasing_return_detailed D on C.ID=D.OUTBOUND_ID"
+" ) A"
+" left join jxc_t_products F on A.P_WARES_ID=F.ID"
+" left join jxc_t_providers C on A.P_SUPPLIER_ID=C.ID"
+" left join shopping_goodsclass G on G.ID=F.GOODSCLASS_ID"
+" left join shopping_goodsclass H on H.ID=G.parent_id"
+" left join shopping_goodsclass I on I.ID=H.parent_id"
+" where A.P_TYPE='0' and A.AUDIT_STATUS='3' ";
图片说明

1个回答

bobbylee0810
bobbylee0810   2016.05.05 19:38

不就是左连接么。。。。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!