Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving data between two tables in one query....HOW????

Status
Not open for further replies.

wouter

Technical User
Jul 3, 2000
45
0
0
NL
Hello,<br><br>i have a problem. I'm currently developing a dynamic website with cold fusion. Everything is going well, except for moving data between two tables in one query.<br><br>One table has the information i need. The record is identified bij an application_id which can be referred to as: Where application_id = '#Var#'<br>The fields in both tables are identical.<br><br>Can someone help me?<br><br>This is what we tried:<br><br>&lt;cfquery name=&quot;Movedata&quot; datasource=&quot;FPA&quot; dbtype=&quot;ODBC&quot;&gt;<br><br> Select Firstname, Add, Lastname, Address, Postalcode, Residence, Function, Company, Phone, Email <br> Into fn, ad, ln, adr, pc, rd, ft, com, ph, em<br> From Applications<br> Where application_id ='#Var#'<br><br> Insert into members<br> values (fn, ad, ln, adr, pc, rd, ft, com, ph, em)<br><br>&lt;/cfquery&gt;
 
Try<br><br>insert into tableA (col1,col2,col3..) select (colC,colD,colA...) from tableB<br><br>You just have to match the cols in the first table with the order in the second table<br><br>HTH <p>Cal<br><a href=mailto: > </a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top