Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT QUERY (?)

Status
Not open for further replies.

PEASLET

Technical User
May 22, 2001
24
GB
Hi - can anyone help with this?
I need to select company details from one table where a certain condition on the most recent record of another table is met. At the moment, it's bringing up all the records of table 2. I expect there's a simple statement to do this but I can't think of it. I would be most grateful for any help with this
 
It would help if you posted your current query. The we can tune it to meet your needs... Terry M. Hoey
 
Code:
SELECT DISTINCTROW [Client Details2].ContactsID, [Client Details2].CompanyName, [Contact Log].FirstName, [Contact Log].LastName, [Follow-up Log].[Places booked], [Follow-up Log].Date
FROM (([Client Details2] INNER JOIN Checklist ON [Client Details2].ContactsID = Checklist.ContactsID) INNER JOIN [Contact Log] ON [Client Details2].ContactsID = [Contact Log].ContactsID) INNER JOIN [Follow-up Log] ON [Client Details2].ContactsID = [Follow-up Log].ContactsID
WHERE ((([Follow-up Log].Details) Like "*CIS*") AND (([Contact Log].[Reason for Contact]) Like "CIS"))
ORDER BY [Follow-up Log].[Places booked] DESC;

It's companies booking on courses and some have booked on more than one course. The details of the courses they have booked on are in the 'Follow-up Log'. I can identify bookings for the current promotion 'CIS' because
[Contact Log].[Reason for Contact]has the entry CIS. I only want the info if it is for the CIS course. I thought I would be able to get just this info by getting the most recent follow up logs as they're all for the CIS course

I'm sorry if this sounds garbled, I'm in a hurry. If you can't understand what I'm on about, I'll try & clarify it later. I really do need the answer though!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top