Last post Jul 15, 2019 02:34 AM by Yang Shen
Jul 14, 2019 10:11 AM|akhterr|LINK
select Salesorder.Orderno,SUM(OrderDetail.orderqty) as orderqty from OrderDetail
inner join Salesorder on Salesorder.OrderNO=OrderDetail.OrderNO
group by Salesorder.Orderno
(select Salesorder.Orderno,sum(Probale.Prdqty) as Produce from Probale
inner join Salesorder on Probale.orderno= Salesorder.Orderno
group by Salesorder.Orderno)
(select orderqty,Produce,(orderqty-Produce) as Pending
group by cte1.orderqty,cte1.Produce,cte1.Pending)
Jul 15, 2019 02:34 AM|Yang Shen|LINK
In the last part of your code, you have
select orderqty,Produce,(orderqty-Produce) as Pending
, but the definition of cte1 is not given.
It's hard to help you reproduce your problem.
If you can provide more complete code, it will be very helpful for us to solve the problem.