Mysql query insert from another table

medgalys

When using the query below I'm inserting product_id and I also want to set field category_id = 4 for all inserted product_ids. Here's my code to insert products.

INSERT INTO lc_products_to_categories
( product_id)
SELECT product_id
FROM lc_products_info
where name like '%awesome product%'

How to update category_id with single query?

Philipp Sander
INSERT INTO lc_products_to_categories
( product_id, category_id)
SELECT product_id, 4
FROM lc_products_info
where name like '%awesome product%'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

MySQL - Insert table data from another table

From Dev

MySQL - Insert table data from another table

From Dev

How to insert multiple rows from a table to another table based on date condition (PHP-MySQL-Query)?

From Dev

looping mysql query to get multiple rows of data from a table and insert into another table

From Dev

Mysql insert into with multiple id from another table

From Dev

Mysql insert column from another table

From Dev

insert multiple rows mysql from another table

From Dev

MySQL insert into column data from another table

From Dev

Insert Data From One Table To Another - MySQL

From Dev

mysql insert into table select from another database

From Dev

MySQL query to insert record into table based on records in another table

From Dev

select from one table, insert into another table oracle sql query

From Dev

mysql query to insert the value of a column with respect to another column in same table

From Dev

MySQL - Insert into a table by querying product id from another table

From Dev

MySQL dynamic INSERT INTO denormalized table from another table

From Dev

How to create sql query to insert values from another table?

From Dev

Insert multiple rows with single a query from one table into another in Oracle

From Dev

db2 query insert from another table

From Dev

SQL - Insert Into Select query with lookup of value from another table

From Dev

Insert from another table, and update if key exists, possible in one query?

From Dev

Select from multiple tables, insert into another table Oracle SQL query

From Dev

Insert query depend on another table

From Dev

MySql: insert into table SELECT from another table where first_table ID =another_table.id

From Dev

MySQL Insert INTO using SELECT from another table with additional data

From Dev

MySQL: Is there a way to insert values from one table to another?

From Dev

MySQL Create Trigger Insert Content into another table from the same database

From Dev

MySQL SELECT from one table and INSERT in another - Performance

From Dev

Insert ID from one table to another in MySQL php

From Dev

MYSQL: Is there a way to Insert Values from another Table with ON DUPLICATE KEY UPDATE?

Related Related

  1. 1

    MySQL - Insert table data from another table

  2. 2

    MySQL - Insert table data from another table

  3. 3

    How to insert multiple rows from a table to another table based on date condition (PHP-MySQL-Query)?

  4. 4

    looping mysql query to get multiple rows of data from a table and insert into another table

  5. 5

    Mysql insert into with multiple id from another table

  6. 6

    Mysql insert column from another table

  7. 7

    insert multiple rows mysql from another table

  8. 8

    MySQL insert into column data from another table

  9. 9

    Insert Data From One Table To Another - MySQL

  10. 10

    mysql insert into table select from another database

  11. 11

    MySQL query to insert record into table based on records in another table

  12. 12

    select from one table, insert into another table oracle sql query

  13. 13

    mysql query to insert the value of a column with respect to another column in same table

  14. 14

    MySQL - Insert into a table by querying product id from another table

  15. 15

    MySQL dynamic INSERT INTO denormalized table from another table

  16. 16

    How to create sql query to insert values from another table?

  17. 17

    Insert multiple rows with single a query from one table into another in Oracle

  18. 18

    db2 query insert from another table

  19. 19

    SQL - Insert Into Select query with lookup of value from another table

  20. 20

    Insert from another table, and update if key exists, possible in one query?

  21. 21

    Select from multiple tables, insert into another table Oracle SQL query

  22. 22

    Insert query depend on another table

  23. 23

    MySql: insert into table SELECT from another table where first_table ID =another_table.id

  24. 24

    MySQL Insert INTO using SELECT from another table with additional data

  25. 25

    MySQL: Is there a way to insert values from one table to another?

  26. 26

    MySQL Create Trigger Insert Content into another table from the same database

  27. 27

    MySQL SELECT from one table and INSERT in another - Performance

  28. 28

    Insert ID from one table to another in MySQL php

  29. 29

    MYSQL: Is there a way to Insert Values from another Table with ON DUPLICATE KEY UPDATE?

HotTag

Archive