What exactly do you want. Do you want:
a. the maximum id in tb_assigned
b. the maximum id in tb_complete
c. the maximum id that occurs in either table
d. the maximum id that occurs in both tables

For a or b you wouldn't need a join
for c you would need to run two separate queries and compare maxvalues
for d you query would work if you prefix the id in max(id) with either table
name

----- Original Message -----
From: "James Taavon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 25, 2000 8:44 AM
Subject: SQL JOIN


> Hello.
>
> 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 and INNER JOIN two resolve this error and
> retrieve the correct value? If so , how? I don't have much practice with
> using JOIN.
>
> Thanks in advance!
>
>
> <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>
>
> <CFSET NextPONum = getnumber.MaxOfID + 1>
>
>
> <cfoutput query="GetNumber">
> #NextPONum#
> </cfoutput>
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> 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.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
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