首页 > 其他 > 详细

SCM Exists 关联查询

时间:2020-03-04 21:12:13      阅读:58      评论:0      收藏:0      [点我收藏+]

Exists  效率应该比in 高一些

SELECT  DictItemID,DictSortCode,DictSortId,DictItemName,DictItemSName
from scm_dict  where   EXISTS( SELECT DictSortCode FROM scm_dict_config where  DictSortCode= scm_dict.DictSortCode)
and del_flag=‘0‘
order by DictSortCode 


SELECT id
        ,DictItemID AS dictItemID
        ,DictSortCode AS dictSortCode
        ,DictSortId AS dictSortId
        ,DictItemName  AS dictItemName
        ,DictItemSName AS dictItemSName
        from scm_dict where  EXISTS( SELECT DictSortCode FROM scm_dict_config where  DictSortCode= scm_dict.DictSortCode)
        and del_flag =‘0‘
        order by DictSortCode

SELECT dictSortCode from scm_dict where dictSortCode=‘sys_bargainor_type‘

SELECT * from scm_dict where create_by !=‘excel‘ or create_by is NULL
and DictItemSName like ‘%集团%‘

update scm_dict d,scm_dict_config c  set d.DictSortCode=c.DictSortCode where d.DictItemSName=c.DictSortName
and  d.DictSortCode is null and  (c.DictSortCode like ‘%_type%‘ or LENGTH(c.DictSortCode)>12)

SELECT d.id,c.id,  d.DictSortCode,d.DictItemSName,c.DictSortCode from scm_dict d INNER join  scm_dict_config c on d.DictItemSName=c.DictSortName
where d.DictSortCode is null and  (c.DictSortCode like ‘%_type%‘ or LENGTH(c.DictSortCode)>12)

  

SCM Exists 关联查询

原文:https://www.cnblogs.com/hoge66/p/12411965.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!