B
bigness
Unregistered / Unconfirmed
GUEST, unregistred user!
SELECT Product_1.Sys_id as ProductId, a.Stockid, SUM(a.P_Number) AS p_Number, SUM(a.P1_Number) <br> AS P1_Number, convert(numeric(20,6) ,case when SUM(a.P_Number) <> 0 then SUM(a.P_total) / SUM(a.P_Number) else 0 end) AS P_price, SUM(a.P_total) AS P_total<br>FROM dbo.Product Product_1 CROSS JOIN<br> (SELECT Product .Sys_id, Product .u_Code, Product .Sys_ParentId, Sys_Fullid, <br> Stockid, SUM(StorStatus.P1_Number) AS P1_Number, <br> SUM(StorStatus.P_Number) AS P_Number, <br> SUM(P_Total) P_total<br> FROM StorStatus INNER JOIN<br> Product ON StorStatus.ProdID = Product .Sys_id<br> GROUP BY ProDuct .Sys_id, Product .u_Code, Product .Sys_ParentId, <br> Product .Sys_Fullid, Stockid) a<br>WHERE (a.Sys_Fullid like Product_1.Sys_Fullid + '%' -----这句怎么样更换查才能提高效率,而查询的效果一样