Show the details of sales orders which are paid more than 14 days after the date of the sales order.
SQL:
SELECT SO.OrderID, D.DistributorID, D.FirstName, D.SurName, SO.OrderDate, P.PaymentDate, P.PaymentAmount
FROM SalesOrder AS SO, Distributor AS D, Payment AS P
WHERE D.DistributorID=SO.DistributorID AND SO.OrderID=P.OrderID AND
DateDiff('yyyy',PaymentDate,Date( ) ) - DateDiff('yyyy',OrderDate,Date( )) <=14;
WHEN I RUN THIS QUERY IT RETURN ALL THE VLAUES OF ORDER..BUT I WANT TO RETURN THE ORDERS WHICH IS PAID AFTER 14 DAYS OR MORE ?
AND I TIRED THIS TOO (date()-P.PaymentDate)>=14; BUT IT DIDNT WORK :-(
ANY SUGGESTIONS ?PLS