> I am evaluating two columns under the same name in two
> different tables. The error I got, "A reference to column
> "ID" is ambiguous" was expected. My code is below. Can I do
> an INNER JOIN two resolve this error and retrieve the correct
> value? If so, how? I don't have much practice with using JOIN.
>
> <CFQUERY NAME="GetNumber" datasource="OIMPROD">
>         SELECT Max(id) AS MaxOfID
>         FROM db2admin.tb_assigned,db2admin.tb_complete
>       where db2admin.tb_assigned.id = db2admin.tb_complete.id
> </cfquery>

You'd have the same problem whether you used an ANSI SQL-92 INNER JOIN or
the WHERE clause join you're using now. The problem is that you have two ID
fields, one in each table, and you have to specify which one you want to
retrieve (even though they'll have the same values because of your join):

SELECT MAX(db2admin.db_assigned.id) ...

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to