Skip to content

Instantly share code, notes, and snippets.

@czwen
Created June 15, 2020 03:41
Show Gist options
  • Save czwen/35a507918e34f02c94d9537dc2a1ca89 to your computer and use it in GitHub Desktop.
Save czwen/35a507918e34f02c94d9537dc2a1ca89 to your computer and use it in GitHub Desktop.
update join
UPDATE t_product
JOIN r_product_class on t_product.id = r_product_class.product_id
JOIN t_class on t_class.id = r_product_class.class_id
SET t_product.school_id = t_class.school_company_id;
UPDATE t_product_template
JOIN r_product_class on t_product_template.product_id = r_product_class.product_id
JOIN t_class on t_class.id = r_product_class.class_id
SET t_product_template.school_id = t_class.school_company_id;
@czwen
Copy link
Author

czwen commented Feb 22, 2021

INSERT INTO table2 (column1, column2, column3, ...)
SELECT column1, column2, column3, ...
FROM table1
WHERE condition;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment