Cool! You shouldn't need those parentheses around the SELECT. Not according to the documentation. Try it without. No reason to slow your parser down. :)
Dave -----Original Message----- From: Bob Imperial [mailto:[email protected]] Sent: Thursday, April 23, 2009 10:08 AM To: cf-newbie Subject: Re: insert into select - mysql Ok I got it now :) finally.... <cfquery name="commitVotes" datasource="packets"> INSERT INTO packet_votes(date_voted,ipaddress,name,packet_id,reason,vote,voter_id) (SELECT vote_attempted,ipaddress,name,packet_id,reason,vote,voter_id FROM temp_votes WHERE voter_id = #form.voterID#) </cfquery> Thanks for reading this though :) Bob > Hi folks, > > I'm trying to do something that seems like it should be relatively > simple but have yet to get it right. In MySQL I have 2 tables, > temp_votes and packet_votes. The temp_votes table holds all voting > data until all packets have been voted on. I am trying to figure out > the syntax for doing INSERT INTO SELECT but have yet to get it right. > My last attempt looks like this: > > <cfquery name="commitVotes" datasource="packets"> > INSERT INTO packet_votes(date_voted,ipaddress,name,packet_id,reason, > vote,voter_id) > SELECT (vote_attempted,ipaddress,name,packet_id,reason,vote,voter_id) > FROM temp_votes > </cfquery> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4536 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
