Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: insert with select troubles.
03-20-2010, 02:56 AM #1
- Join Date
- Apr 2003
- in my house
- Thanked 201 Times in 197 Posts
insert with select troubles.
Yay!! I got it with singel quotes. Thought I had previously tried that.
When inserting to an archive table with data selected from a 'live' table, I want also to input to the archived table, the name of the person who did it ~ $admin
I can't seem to work out how to get the $admin var into the insert. I seek your guidance.
INSERT INTO files_archived ( business_id , content_category , file_name , file_text , live_from , when_archived , archived_by ) SELECT business_id , content_category , file_name , file_text , live_from , CURRENT_TIMESTAMP , "$admin" FROM files as f WHERE f.business_id = ? AND f.content_category = ? AND f.file_name = ? AND f.live_from = ? and archived_by = ?