The error means that InvoiceTemplateType_Key is a column in both tables, so 
you have to let the database know which one you actually want.  Use your 
table aliases:

<cfquery name="qgetcreditnotetemplate" datasource="#request.dsn#">
                                             SELECT 
IT.InvoiceTemplate_FileName, 
          IT.InvoiceTemplateType_Key, 
          I.Invoive_Key
     FROM InvoiceTemplate IT, INVOICE I
     WHERE I.IINVOICE_Key = #url.invoice#
          AND IT.InvoiceTemplateType_Key = 1
                                        </cfquery>

Looks like you're not JOINing your tables either, which could be pretty bad 
in both performance and results, and please be sure you're using 
CFQUERYPARAM in actual code to screen that URL variable.  Something like 
this (making assumptions here about data types and column references):


<cfquery name="qgetcreditnotetemplate" datasource="#request.dsn#">
                                             SELECT 
IT.InvoiceTemplate_FileName, 

          IT.InvoiceTemplateType_Key, 

          I.Invoive_Key
     FROM InvoiceTemplate IT INNER JOIN
          INVOICE I ON IT.InvoiceTemplateType_Key = 
I.InvoiceTemplateType_Key
     WHERE I.IINVOICE_Key = <cfqueryparam cfsqltype="CF_SQL_INTEGER" 
value="#url.invoice#" />
          AND IT.InvoiceTemplateType_Key = <cfqueryparam 
cfsqltype="CF_SQL_INTEGER" value="1" />
                                        </cfquery>

 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:326482
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