Michiel

i believe you need to tell the target what fields it will have too...

INSERT INTO Table1 (A, B)
SELECT Table2.A, Table2.B
FROM Table2

Of course you can omit the Table2. part in this trivial case.

making it
INSERT INTO Table1 (A, B)
SELECT A, B
FROM Table2

-----Original Message-----
From: Michiel Leegwater [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 20, 2001 3:25 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Problem with INSERT INTO ... SELECT


Hello,

This is the situation:
Table1:
ID      Startnr Tijd    Afstand Slag    Datum   Opmerking       CRvan   CRtot   PR     
 Categorie

Table2:
Identical columns.

What is the problem? I'm trying to append all the values from table2 to
table1.

I was trying this SQL query:

insert into table1 select Startnr, Tijd, Afstand, Slag, Datum, Opmerking,
CRvan,CRtot,PR,Categorie from table2;

This doesn't work, it says "Column count doesn't match value count at row 1"
I understand the problem. But I can't use my ID column in the select query
because both tables have an AUTO INCREMENT ID. Does someone have any
suggestions how to work around this??

Thanks in advance

Michiel Leegwater



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to