You need to do a select distinct on the subquery of places visited: (select distinct salesmanid,placesid from trips where date between from and to) a then do your outer join on salesmanid and placeid (depending on your db) with a query of salesmen and places (select salesman.id,place.id from salesmen, trips) b to get those in b and not in a.
-----Original Message----- From: Thane Sherrington [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 03:18 To: CF-Talk Subject: Having trouble with a query I have a query I can't get working. I want to be able to display a list of places that have not been visited by a specific salesman in the last X months. In other words, I want to show something like this: Show me all places not visited in the last 3 months: Place A Bob Place B Bob Place C Fred Place D Fred Place A Sally Place D Sally I have the information in three tables: Trips PlaceID SalesmanID Date Salesmen Name ID Places Name ID My problem is when I do the query, I end up getting the same place more than once. If Bob visited Place A in November and December, then it'll show up twice for him. How could I make it show up once? T ______________________________________________________________________ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

