'SQL INSERT STATEMENT, ONLY TWO VALUES INTO A TABLE WHICH HAS MANY COLUMNS [closed]

INSERT INTO your_table_name (your_column_name, your_id )
VALUES (select your_column_name from another_table, 'abc');

the above logic doesn't seem to work, can anyone suggest a better idea?



Solution 1:[1]

At a minimum, you can either do an insert ... select or a insert ... values but you can't combine the two. If you want to do a select, you'd need an insert ... select

INSERT INTO your_table_name (your_column_name, your_id ) 
  select your_column_name, 'abc' 
    from another_table;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Justin Cave