When are you trying to distinguish between the two?  In your 
SQL statement, or when you loop over the query?


 In your SQL statement you can distinguish between the two columns 
of the same name by using 'tablename.column', like this:

 select table1.ID, table2.ID 
 from table1, table2
 where table1.ID = table2.ID


 If you want to reference then in ColdFusion, after you did SQL the 
above will need a modification, because queryname.ID will not know which
one to go with.

 You can use column aliases, like this:

   select table1.ID as tableoneID, table2.ID as tabletwoID
   from table1, table2
   where table1.ID = table2.ID


  When looping over the query, you can reference the values by their 
alias, like:

   ID from table 1: #queryname.tableoneID#  
   ID from table 2: #queryname.tabletwoID#


  Make sense?  

Michael She wrote:
> 
> If I'm joining multiple tables together and they have columns with the same
> name, how do I distinguish between them?
> 
> I've tried: #queryname.table.column_name# but this doesn't seem to work.
> 
> Thanks.
> --
> Michael She
> I m a g i n e   C o m m u n i c a t i o n s
> Company E-mail: [EMAIL PROTECTED]
> Personal E-mail: [EMAIL PROTECTED]
> ICQ UIN: #243466
> Personal Homepage: http://www.michaelshe.com (Under Construction)
> Imagine Communications: http://www.imagineer.net
> PGP Fingerprint: 9A24 1DA9 39B8 0A0C C5ED 6E5D 45E9 075A 51CD 66A1
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Structure your ColdFusion code with Fusebox. Get the official book at 
>http://www.fusionauthority.com/bkinfo.cfm
> 
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

-- 
Jeff Houser | mailto:[EMAIL PROTECTED]
AIM: Reboog711  | ICQ: 5246969 | Phone: 860-229-2781
--
Instant Cold Fusion 4.5  | ISBN: 0-07-213238-8   
Due out 3rd Quarter 2001
--
DotComIt, LLC
database driven web data using ColdFusion, Lotus Notes/Domino
--
Half of the Alternative Folk Acoustic Duo called Far Cry Fly 
http://www.farcryfly.com | http://www.mp3.com/FarCryFly
--
Promise me no dead end streets, and I'll guarantee we'll have a road
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to