FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » copy data from one table to another table
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
copy data from one table to another table [message #172820] Fri, 04 March 2011 02:39 Go to previous message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma:
Member
I have a table that I want to copy selected fields into another table.
The footprint of the tables is different. Here is the INSERT I am
trying to use.

An error is returned, "SQL Error (1136); Column count doesn't match
value count at row 1.
I've run the SELECT without the INSERT line and it does select the
data I want to copy.

Comparing the fields in "births"with the fields defined by the SELECT,
The only field that is missing is the primary key (birthid), which I
assumed the INSERT would fill in..

USE genealogyvr;

INSERT IGNORE INTO births
SELECT
NewspaperKey AS newspaperid,
CONCAT(Year, "-",
IF(Month < 10, CONCAT("0",Month), Month) ,
"-" ,
IF(Day < 10, CONCAT("0", Day), Day) ) AS paperdate,
Page AS page,
Col AS col,
FatherFirst AS fatherfirst,
FatherMiddle AS fathermiddle,
MotherFirst AS motherfirst,
MotherMiddle AS mothermiddle,
MotherMaiden AS mothermaiden,
First AS childfirst,
Middle AS childmiddle,
Last AS childlast,
DateOfBirth AS dob,
Comments AS comment

FROM birthsaccess
WHERE Year < 1890;
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: fgetcsv -- No error reporting?
Next Topic: getimagesize now throwing an error after a server update
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 01:25:20 GMT 2024

Total time taken to generate the page: 0.04849 seconds