كيفية الكتابة الانضمام حدد الاستعلام في MSACCESS؟
-
19-09-2019 - |
سؤال
قل لدي هذه الجداول مع أسماء الحقول تحتها.
DailyLeaveLedger
dldEmployeeID
dldLeaveDate
InvoiceHeader
invEmployeeID
invWeekEnding
InvNumberWeeksCovered
لذلك أريد أن يختار الاستعلام عن ترك الأيام التي تغطي فيها الفاتورة التي تترك IE Invweekending 02 أكتوبر و Invnumbeweekscovered = 1 ثم أي إجازة في النطاق 26 سبتمبر إلى 02 أكتوبرك على ما يرام. كما يجب أن يكون لديك تطابق حقول الموظفين.
في MSACCESS 2003 من فضلك؟
المحلول
جرب هذا
SELECT InvoiceHeader.invEmployeeID,
InvoiceHeader.invWeekEnding,
DateAdd("d",-[InvNumberWeeksCovered]*7,[invWeekEnding]) AS StartDate,
DailyLeaveLedger.dldLeaveDate
FROM InvoiceHeader
INNER JOIN DailyLeaveLedger
ON InvoiceHeader.invEmployeeID = DailyLeaveLedger.dldEmployeeID
WHERE (((DailyLeaveLedger.dldLeaveDate)
Between [invWeekEnding]
And DateAdd("d",-[InvNumberWeeksCovered]*7,[invWeekEnding])));
ما قمت بإضافة -7 * Invnumbeweekscovered إلى الدعوة، ثم تحقق من التواريخ بين هذه.
امل ان يساعد.
لا تنتمي إلى StackOverflow