sqlmariadb

Importing information of just one column from another table


I want to fill out a column named employee_id from another table by using select below is my query

INSERT INTO information (employee_id)
VALUES (SELECT employee_id FROM employee)

with the above query I am getting an error:

MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT employee_id FROM employee)' at line 3**


Solution

  • try like this:

    INSERT INTO information (employee_id)
    SELECT employee_id FROM employee;