Not sure why you would want to do this. It wouldn't make sense in any db
I've ever come across. If there should be a match between primary keys, then
should there not be a value of pdfid in table2 to match the orderno you want
to use to set the value in table1? Is it not also possible that it might
already exist in table1? 
If this is part of a working system I would think a bit more about your db
structure. 
If it's just a one off then, depends what db you are doing it in.
In access you could do it like this
UPDATE Table1 INNER JOIN Table2 ON Table1.pdfid = Table2.pdifd SET
Table1.pdfid = [orderno];

In sql server you would need to create aview first

create view doupdate as
select table1.pdfid, table2.orderno
from table1, table2
where table1.pdfid=table2.pdfid)

Then you can do an update on it as if it was a table

update doupdate set pdfid=orderno

Not sure how you'd do it in Oracle

-----Original Message-----
From: David Clay [mailto:[EMAIL PROTECTED]]
Sent: 09 July 2001 23:54
To: CF-Talk
Subject: Update Statement


Need help updating table1 PDFID value with table2 orderno value where
primary key in table1 equals primary key in table2.

table1

primarykey=PDFID
field=country

Table2

primarykey=PDFID
field=orderno


Any help with the SQL statement or CF code would be appreciated.  Thank you



Dave Clay
Internet Facilitator
Trus Joist, A Weyerhaeuser Business
5995 Greenwood Plaza Blvd, Suite 100
Greenwood Village, CO 80111
303.770.8506
303.770.8506
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to