只是查詢,不做刪除吧:
創(chuàng)新互聯(lián)是一家專注于網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)與策劃設(shè)計(jì),靈山網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:靈山等地區(qū)。靈山做網(wǎng)站價(jià)格咨詢:028-86922220
SELECT * FROM 表1 WHERE name NOT IN (
SELECT name FROM 表2
)
CREATE TABLE A (
`C1` VARCHAR(10),
`C2` VARCHAR(10),
`C3` VARCHAR(10),
`C4` VARCHAR(10),
`C5` INT
);
INSERT INTO A
SELECT '華北', '遼寧', '沈陽', '20020202', 2 UNION ALL
SELECT '華東', '山東', '青島', '18020133', 3 UNION ALL
SELECT '華北', '北京', '北京', '7193', 7 UNION ALL
SELECT '華北', '北京', '北京', '8358', 5 UNION ALL
SELECT '華北', '北京', '北京', '9773', 8 UNION ALL
SELECT '華東', '山東', '青島', '18020133', 5 ;
CREATE TABLE B (
`C1` VARCHAR(10),
`C2` VARCHAR(10),
`C3` VARCHAR(10),
`C4` VARCHAR(10),
`C5` INT
);
INSERT INTO B
SELECT '華北', '遼寧', '沈陽', '20020202', 5 UNION ALL
SELECT '華東', '山東', '青島', '18020133', 6 UNION ALL
SELECT '華北', '北京', '北京', '7193', 2 UNION ALL
SELECT '華東', '甘肅', '蘭州', '7364', 3 UNION ALL
SELECT '華東', '湖北', '武漢', '7512', 7 UNION ALL
SELECT '華東', '湖北', '武漢', '7512', 2 UNION ALL
SELECT '華東', '江蘇', '常州', '7582', 5 UNION ALL
SELECT '華東', '江蘇', '淮安', '7670', 7;
SELECT
IFNULL(A.`C1`, B.`C1`) AS `區(qū)域`,
IFNULL(A.`C2`, B.`C2`) AS `省份`,
IFNULL(A.`C3`, B.`C3`) AS `城市`,
IFNULL(A.`C4`, B.`C4`) AS `編碼`,
SUM(A.`C5`) AS `表A銷量`,
SUM(B.`C5`) AS `表B銷量`
FROM
A LEFT JOIN B
ON (
A.`C1` = B.`C1` AND
A.`C2` = B.`C2` AND
A.`C3` = B.`C3` AND
A.`C4` = B.`C4`
)
GROUP BY
IFNULL(A.`C1`, B.`C1`),
IFNULL(A.`C2`, B.`C2`),
IFNULL(A.`C3`, B.`C3`),
IFNULL(A.`C4`, B.`C4`)
UNION
SELECT
IFNULL(A.`C1`, B.`C1`) AS `區(qū)域`,
IFNULL(A.`C2`, B.`C2`) AS `省份`,
IFNULL(A.`C3`, B.`C3`) AS `城市`,
IFNULL(A.`C4`, B.`C4`) AS `編碼`,
SUM(A.`C5`) AS `表A銷量`,
SUM(B.`C5`) AS `表B銷量`
FROM
A RIGHT JOIN B
ON (
A.`C1` = B.`C1` AND
A.`C2` = B.`C2` AND
A.`C3` = B.`C3` AND
A.`C4` = B.`C4`
)
GROUP BY
IFNULL(A.`C1`, B.`C1`),
IFNULL(A.`C2`, B.`C2`),
IFNULL(A.`C3`, B.`C3`),
IFNULL(A.`C4`, B.`C4`);
+------+------+------+----------+---------+---------+
| 區(qū)域 | 省份 | 城市 | 編碼 | 表A銷量 | 表B銷量 |
+------+------+------+----------+---------+---------+
| 華北 | 遼寧 | 沈陽 | 20020202 | 2 | 5 |
| 華北 | 北京 | 北京 | 7193 | 7 | 2 |
| 華北 | 北京 | 北京 | 8358 | 5 | NULL |
| 華北 | 北京 | 北京 | 9773 | 8 | NULL |
| 華東 | 山東 | 青島 | 18020133 | 8 | 12 |
| 華東 | 甘肅 | 蘭州 | 7364 | NULL | 3 |
| 華東 | 湖北 | 武漢 | 7512 | NULL | 9 |
| 華東 | 江蘇 | 常州 | 7582 | NULL | 5 |
| 華東 | 江蘇 | 淮安 | 7670 | NULL | 7 |
+------+------+------+----------+---------+---------+
9 rows in set (0.00 sec)
差集是要交個(gè)面域交匯在一起并且在同一個(gè)平面上才可以進(jìn)行交集的;交集-選取目標(biāo)1+目標(biāo)2-鼠標(biāo)右鍵單機(jī)就行了
select?URL?from?TABLEA?
where???url?not?in?(select?URL?from?TABLEB?where?APP_NAME=TABLEA.APP_NAME)
樓主可以用curl_exec() 從一個(gè)頁面訪問另外一個(gè)頁面 拿到你的json 然后 json_decode一下 然后跟你本地的進(jìn)行對比就好了