CREATE A SQL QUERY
The customer ID and society call and the longest retrogression in shipping on any dispose to that customer. Express the retrogression in weeks and attribute the output in ascending dispose by the retrogression.
As we want to obtain longest retrogression. So retrogression should in shipping part. We can invent retrogression by subtracting the required continuance and express shipped continuance.
Select sc.custid , sc.companyname,
(So.shippedcontinuance – so.requireddate)/7 retrogression
From Sales.Orders so, sales.Customers sc
Where so.custid = sc.custid
Dispose by retrogression