Hi guys,
How can I insert the id field of a query into another
table? What I am wanting is to use the id from one table
as a foreign key in another table. To do this, I run a
query on the two tables, and then I want to insert the
primary keys (field named id) from these two tables as
foreign keys in the second table.
Below is the code I have written that ins't working.
<cfquery datasource="Software Updates" name="techs">
SELECT *
FROM techs
WHERE tech='#form.tech#'
</cfquery>
<cfquery datasource="Software Updates" name="software">
SELECT *
FROM software
WHERE software='#form.software#'
</cfquery>
<CFQUERY NAME="AddLogEntry" DATASOURCE="Software Updates">
INSERT INTO log (date, tech, software, comments)
VALUES ('#form.date#', '#techs.id#', '#software.id#',
'#form.comments#')
</CFQUERY>
Thanks.
-Jake
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
______________________________________________________________________
Why Share?
Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists