barkster Posted September 29, 2008 Share Posted September 29, 2008 how do insert a row from one table into another while using the new autoid provided by the new table. Because I'm not passing the autoid from the old table to the new it says column count incorrect. Do I have to look up the new autoid first or is there a way around this, InvoiceID is my autoid field "INSERT INTO Invoices SELECT CustomerID,SalesTax,OrderDate,Timestamp,TransactStatus, ErrLoc, ErrMsg, Paid, Deleted, InvoiceTotal, Notes, Quote, Mileage, billdate, recur, recurdays FROM Recurring WHERE InvoiceID='".$id."'"; Quote Link to comment https://forums.phpfreaks.com/topic/126308-solved-insert-rows-from-one-table-to-another-using-new-autoid/ Share on other sites More sharing options...
Barand Posted September 29, 2008 Share Posted September 29, 2008 Pass NULL in place of the id value. Quote Link to comment https://forums.phpfreaks.com/topic/126308-solved-insert-rows-from-one-table-to-another-using-new-autoid/#findComment-653189 Share on other sites More sharing options...
barkster Posted September 29, 2008 Author Share Posted September 29, 2008 ah, didn't think of that. Quote Link to comment https://forums.phpfreaks.com/topic/126308-solved-insert-rows-from-one-table-to-another-using-new-autoid/#findComment-653206 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.