إنتقال للمحتوى

  • تسجيل الدخول عبر الفيس بوك تسجيل الدخول عبر تويتر Log In with LinkedIn Log In with Google      تسجيل دخول    
  • إنشاء حساب

صورة
- - - - -

Pls I Need Help In Date Function


لا توجد ردود على هذا الموضوع

#1 khaleddn

khaleddn

    عضو

  • الأعضــاء
  • 2 مشاركة

تاريخ المشاركة 12 September 2010 - 10:14 AM

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
this is in microsft access