Is there any reason why you are keeping duplicate records in table 2. If you
kept it unique, then you wouldn't have this problem. But to do it with the
data you have. You need to make a unique selection from table2 and then link
it back to table1. Something like this should work.
Select table1.* , t2.email
from table1 (select distinct id,email from table2) t2
where t2.id=table1.id
-----Original Message-----
From: tom muck [mailto:[EMAIL PROTECTED]]
Sent: 22 August 2001 19:26
To: CF-Talk
Subject: OT:SQL syntax again
I have a simple query question that I haven't been able to figure out. I
have a simple table like this (table 1):
id,time
2,8/19/01
2,8/20/01
3,8/21/01
That table could have corresponding matches in a second table:
id, email
1,[EMAIL PROTECTED]
2,[EMAIL PROTECTED]
2,[EMAIL PROTECTED]
2,[EMAIL PROTECTED]
3,[EMAIL PROTECTED]
I need to match the ID number from table 1 to table 2, but only return
results from table 1. In other words, I want my query results to show:
id,time,email
2,8/19/01,[EMAIL PROTECTED]
2,8/20/01,[EMAIL PROTECTED]
3,8/21/01,[EMAIL PROTECTED]
Every join I've tried gives me results that include all ID matches from
table 2, which would be 4 rows and not 3 in this example. How would the
query be worded for this?
tom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
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