1

Here is my query:

insert into unique_products values (product_id, serial_numnber, pronexo_code, entry_time, exit_time, guarantee_long, expanded_guarantee_long)
select product_id, serial_number, pronexo_code, start_guarantee_date, start_guarantee_date, guarantee_long, expanded_guarantee_long
from table_24

It throws this error message:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select product_id, serial_number, pronexo_code, start_guarantee_date, start_guar' at line 2

Does anybody know what's the problem and how can I fix it?

3 Answers 3

1

Remove the VALUES key word from your Query.

Try this:

INSERT INTO unique_products (product_id, serial_numnber, pronexo_code, entry_time, exit_time, guarantee_long, expanded_guarantee_long)
SELECT product_id, serial_number, pronexo_code, start_guarantee_date, start_guarantee_date, guarantee_long, expanded_guarantee_long
FROM table_24;
Sign up to request clarification or add additional context in comments.

Comments

1

try this :

  insert into unique_products (product_id, serial_numnber, 
  pronexo_code, entry_time, exit_time, guarantee_long, 
  expanded_guarantee_long)
  select product_id, serial_number, pronexo_code, start_guarantee_date, 
  start_guarantee_date, guarantee_long, expanded_guarantee_long
  from table_24

Comments

1

Take care at the SQL syntax and at the field name typing:

VALUE keyword is incorrect here, and watch serial_numnber or serial_number correct spelling for your field name:

insert into unique_products (product_id, SERIAL_NUMBER, pronexo_code, entry_time, exit_time, guarantee_long, expanded_guarantee_long)
select product_id, SERIAL_NUMBER, pronexo_code, start_guarantee_date, start_guarantee_date, guarantee_long, expanded_guarantee_long
from table_24

Details on correct INSERT-INTO-SELECT syntax here.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.