<cfquery> Duplicating

Hi im running the below query but its picking up the email address 8 times, even tho the INVOICE_Key and the name of the actual Invoice only occurs once in the table
any ideas?


<cfquery name="Getemails" datasource="#TEST#">
  	SELECT CU.CUSTOMER_Email,C.COMPANY_Email 
	FROM Customer CU, Company C, Invoice I
 	Where I.COMPANY_Number = C.Company_Number
  	AND I.CUSTOMER_AccNum = CU.CUSTOMER_AccNum
  	AND I.CUSTOMER_DelvNum = CU.CUSTOMER_DelvNum
	AND I.Invoice_Key IN (#form.INVOICE_Checktosendemail#)
</cfquery>

Are there per chance, 8 matching invoices …

nope just the 1
I notice now that the query is not matching up the company which I have selected in the previous screen
how do I go about doing this

we can help you only if we knew how this “matching up” is supposed to work

on the previous screen (dsp_search.cfm) I have a list box where you select the company you wish to use known as COMPANY_Number
from there I want it to pass it onto the Action page Act_Send.cfm) so it remembers it in this query below


<cfquery name="Getemails" datasource="#TEST#">
  	SELECT CU.CUSTOMER_Email,C.COMPANY_Email 
	FROM Customer CU, Company C, Invoice I
 	Where I.COMPANY_Number = C.Company_Number
  	AND I.CUSTOMER_AccNum = CU.CUSTOMER_AccNum
  	AND I.CUSTOMER_DelvNum = CU.CUSTOMER_DelvNum
	AND I.Invoice_Key IN (#form.INVOICE_Checktosendemail#)
</cfquery>

i’m afraid you will have to share with us the design of your table relationships (primary and foreign keys)

Customer and Company do not seem to be related in your query