27 Dec 2016

MySQL Query

Copy Data form one table to another table.

INSERT INTO `tbl_tbl1` [(fields )]
SELECT [clmns] FROM `tbl_tbl2`;
  ------------------------------------------------------------------------------------------------------------------

Get / Find Changed Values form table 1 to table 2

SELECT mfg_part_no FROM `tbl_comp_prod1` AS cp1
WHERE  CONCAT(cp1.mfg_part_no,cp1.price) NOT IN
(SELECT CONCAT(mfg_part_no,price) FROM tbl_comp_prod2)
OR CONCAT(cp1.mfg_part_no,cp1.`msrp`) NOT IN (SELECT CONCAT(mfg_part_no,msrp) FROM tbl_comp_prod2);

No comments:

Post a Comment