You'll have to reference them as alias.columnname or select them with a
different alias like...

Select a.userID as AuserID, b.userID as BuserID

I would say that they are the same in most cases though yes? If so, there's
no need to select both at all.

-----Original Message-----
From: Jim McAtee [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 24, 2007 2:03 PM
To: CF-Talk
Subject: How should SQL handle same named columns from different tables?

SELECT a.*, b.*
FROM user a INNER JOIN userprefs b ON b.userid = a.userid
WHERE username = 'bsmith'

In the query there's a common column named 'userid'.  Should the query 
retun

1) one column named userid
2) two columns named userid
3) two columns with some type of unique name for each

I find that the CF8 'Microsoft Access with Unicode' driver does #3, which 
I hadn't seen before in other ODBC drivers.  It returns two columns named 
'a.userid' and 'b.userid'. 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292056
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to