Comment écrire requête de jointure sélectionnez dans MS Access?
-
19-09-2019 - |
Question
Dire que j'ai ces tables avec des noms de champ situé en dessous.
DailyLeaveLedger
dldEmployeeID
dldLeaveDate
InvoiceHeader
invEmployeeID
invWeekEnding
InvNumberWeeksCovered
Je veux une requête sélectionne les jours de congé où une facture couvre que le congé-à-dire le 2 octobre invWeekEnding et InvNumberWeeksCovered = 1 alors tout congé dans la plage 26 septembre à 2 octobre est ok. De plus, vous devez avoir des champs de correspondance EMPLOYEEID.
En 2003 MSAccess s'il vous plaît?
La solution
Essayer cette
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])));
Ce que je faisais était add -7 * InvNumberWeeksCovered à la invdate, puis vérifier les dates entre ces derniers.
L'espoir qui aide.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow