>
>
> <cfquery name="qgetinvoices" datasource="#request.dsn#">
> select I.INVOICE_DateAdded, I.COMPANY_Number, I.INVOICE_Number,
> C.COMPANY_Name, I.INVOICE_Key, I.CUSTOMER_AccNum, CU.CUSTOMER_Name
> from INVOICE I, COMPANY C, CUSTOMER CU
> where I.COMPANY_Number = C.COMPANY_Number
> AND I.COMPANY_Number = '#form.COMPANY_Number#'
> AND I.INVOICE_Number LIKE '%#form.INVOICE_Number#%'
> AND I.CUSTOMER_AccNum LIKE '%#form.CUSTOMER_AccNum#%'
> AND CU.CUSTOMER_Name LIKE '%#form.CUSTOMER_Name#%'
> AND I.INVOICE_PDFFile <> ''
> </cfquery>
>
>
This query looks like it gets the results for your search.

You have 3 tables: invoice, company, and customer.  You join the invoice
table and the company table via the SQL, I.COMPANY_Number =
C.COMPANY_Number.
Unfortunately you do not join customer table to the other 2 tables.  This is
why you are always getting more results than you want.  You need to join the
invoice table to the customer table.


the top half of your code looks like it was not a full cut and paste.  If it
was then it really doesn't make any sense.  What is the query, qgetcustomer,
being used for?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328954
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to