Try not to use *, especially on multiple tables. And you need to link in
your customers table somehow or you'll have a complete mess...

Do something like 
<cfquery name="Getcustomer" datasource="printprices">
SELECT Lastname, firstname, c.customerid, o.orderid, b.booktitle
FROM  customers c inner join orders o on c.customerid=o.customerid join
bookinfo b on b.bookid=o.bookid

This also leaves your where clause free for other types of filters (ie:
where order date between Jan and june/etc...)
 if you use an alias there won't be any problems with ambiguous field names.
Also, it easier 6 mo down the road when you revisit the issue...
Good luck
 

-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 11: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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to