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."'"; 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. 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. 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
Archived
This topic is now archived and is closed to further replies.