Bobadopolis
No I can't fix it dammit!
- Local time
- Today, 04:12
- Joined
- Oct 6, 2005
- Messages
- 77
Hi,
I have two tables:
tblListeners
-----------
ID (PK)
FirstName
LastName
etc
tblReference
------------
ID (PK)
ListenerID
ReferenceTypeID (FK)
ReferenceDate
etc
(Btw I am aware of the unconventional naming of the PKs but I'm running the B/E on SharePoint so I have no choice!)
So listeners have to periodically do a reference. What i want is a query that tracks if listeners either have not done a reference EVER or haven't done one for a while, but broken down by the FK in tblReference.
Here is my reasonably simple SQL so far:
In the current query the results ignore the FK so the so a listener will be missing if they have done one type of reference - i want them to be there (or not be there) for each type of reference. Hope that makes sense!
Now i know people may suggest a crosstab for this but: a) I don't get on with them and wouldn't know how to implement it and b) this will need to be in a report and I don't want to venture down the 'dynamic crosstab report' path!
Any ideas?
Cheers,
Bobadopolis
I have two tables:
tblListeners
-----------
ID (PK)
FirstName
LastName
etc
tblReference
------------
ID (PK)
ListenerID
ReferenceTypeID (FK)
ReferenceDate
etc
(Btw I am aware of the unconventional naming of the PKs but I'm running the B/E on SharePoint so I have no choice!)
So listeners have to periodically do a reference. What i want is a query that tracks if listeners either have not done a reference EVER or haven't done one for a while, but broken down by the FK in tblReference.
Here is my reasonably simple SQL so far:
Code:
SELECT tblListeners.ID AS ListenerID, tblListeners.FirstName, tblListeners.LastName, tblReference.ReferenceTypeID, tblReference.ReferenceDate
FROM tblListeners LEFT JOIN tblReference ON tblListeners.ID = tblReference.ListenerID
WHERE (((tblReference.ListenerID) Is Null) AND ((tblReference.ReferenceDate) Is Null)) OR (((tblReference.ReferenceDate)<DateAdd("m",-6,Date())))
ORDER BY tblListeners.FirstName, tblListeners.LastName;
In the current query the results ignore the FK so the so a listener will be missing if they have done one type of reference - i want them to be there (or not be there) for each type of reference. Hope that makes sense!
Now i know people may suggest a crosstab for this but: a) I don't get on with them and wouldn't know how to implement it and b) this will need to be in a report and I don't want to venture down the 'dynamic crosstab report' path!
Any ideas?
Cheers,
Bobadopolis