Rob,

You need to alias the ambiguous column.  to do this you will need to spell
out your columns rather than use the wild card.  For example:

        SELECT B.bookTitle, B.author, O.orderId, C.customerName, C.CustomerID
         FROM bookinfo B JOIN Orders O on B.bookid = o.bookid
                JOIN customers C on O.customerid = C.customerid


It's always a good idea to show your columns in the query. That way you know
what you are getting.  In this case there is a column called 'customerid' in
the Orders table and ALSO in the Customers table. the driver returns a
record set with the column names as keys.  since you would end up with 2
columns with the same name, it throws an error.

-Mark



-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 10:36 AM
To: CF-Talk
Subject: ambiguous


I get a How do I fix this SQL error please?

ODBC Error Code = 37000 (Syntax error or access violation)<P><P>
[Microsoft][ODBC SQL Server Driver][SQL Server]Ambiguous column name
'customerid'

Both orders and customers have a customerid column

My statement:

<cfquery name="Getcustomer" datasource="printprices">
SELECT * FROM bookinfo, orders, customers
Where bookinfo.bookid = orders.bookid

Thanks!

Robert O
HWW

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to