mysql如何解决两个表查询处理结果后的两个字段值比较
资源为两个表sheet7、sheet1sheet7为城市信息
sheet1为机构名称
1查询结果sheet7,查询后得出一个为城市的信息字段(字段值例如:北京)
2查询结果sheet1,查询后为机构名称的信息字段(字段例如:北京分行)
求助,把1的查询结果与2的查询结果比较,得出1里字段值没在2的里字段值出现的信息显示出来。
例如:1里字段值`北京`、`天津`等,2里有个字段值为`分行朝阳区支行`、`分行天津集团`,比较1和2后,2里没`北京`、`天津`字段值,就显示出2里这个字段值为`分行朝阳区支行`
1查询过程
SELECT REPLACE(a.city,'市','')
from `sheet7` A
WHERE (COUNTRY like '%中国%')
AND (CITY LIKE '%市%'AND CITY NOT LIKE '%区%' AND CITY NOT LIKE '%删除%' )
2查询过程
SELECT
ORG_ID ,
ORG_NM,
ORG_NM_XPN,
CONCAT(ORG_NM,ORG_NM_XPN) AS JIGOUQUANCHENG
from `sheet1`
WHERE (ORG_LVL_CD not like '%总行部室%'
and ORG_LVL_CD not like '%全行%'
AND ORG_NM not like '%关闭%'
AND ORG_NM not like '%删%'
AND ORG_NM not like '%停%'
AND ORG_NM_XPN not like '%关闭%'
AND ORG_NM_XPN not like '%删%'
AND ORG_NM_XPN not like '%停%'
)
AND
( LEFT (DIR_SUP_ORG_ID,3) NOT LIKE '%100%'
AND LEFT (DIR_SUP_ORG_ID,3) NOT LIKE '%101%'
AND LEFT (DIR_SUP_ORG_ID,3) NOT LIKE '%102%')
页:
[1]