zoukankan      html  css  js  c++  java
  • sqlserver to oracle

    SELECT     c.*, d .Organization_Name, d .ParentId, e.Roles_ID, e.Roles_Name
    FROM
    (    
        SELECT a.*, b.Organization_ID
        FROM
        (
            SELECT a.User_ID, MIN(User_Code) User_Code, MIN(User_Account) User_Account,
             MIN(User_Pwd) User_Pwd, MIN(User_Name) User_Name, MIN(User_Sex) User_Sex,
              min(User_IDcardNo) User_IDcardNo, MIN(Mobile) Mobile, MIN(DeleteMark) DeleteMark, 
              ztbm_id_s = STUFF (
                                (SELECT ',' + b.ZTBM_ID FROM TB_ZYM_UserZTBM b WHERE b.User_ID = a.User_ID FOR XML PATH('')),
                                 1, 1, ''
                                 )
            FROM Base_UserInfo a
            GROUP BY a.user_id
        ) a 
        LEFT OUTER JOIN dbo.Base_StaffOrganize b ON a.User_ID = b.User_ID) c 
        LEFT OUTER JOIN dbo.Base_Organization d ON c.Organization_ID = d .Organization_ID
        LEFT OUTER JOIN (
        SELECT b.*, a.User_ID FROM dbo.Base_UserRole a 
        INNER JOIN dbo.Base_Roles b ON a.Roles_ID = b.Roles_ID
    ) 
    e ON e.User_ID = c.User_ID
    SELECT     c.*, d .Organization_Name, d .ParentId, e.Roles_ID, e.Roles_Name
    FROM
    (    
        SELECT a.*, b.Organization_ID
        FROM
        (
            SELECT   a.User_ID, MIN(User_Code) User_Code, MIN(User_Account) User_Account, 
            MIN(User_Pwd) User_Pwd, MIN(User_Name) User_Name, MIN(User_Sex) User_Sex, min(User_IDcardNo) 
                  User_IDcardNo, MIN(Mobile) Mobile, MIN(DeleteMark) DeleteMark
                  ,(select wm_concat(b.ZTBM_ID) from TB_ZYM_UserZTBM b WHERE b.User_ID = a.User_ID ) ztbm_id_s
            FROM      Base_UserInfo a
            GROUP BY a.user_id
        ) a 
        LEFT OUTER JOIN Base_StaffOrganize b ON a.User_ID = b.User_ID
    ) c 
    LEFT OUTER JOIN Base_Organization d ON c.Organization_ID = d .Organization_ID
    LEFT OUTER JOIN (
        SELECT b.*, a.User_ID FROM Base_UserRole a 
        INNER JOIN Base_Roles b ON a.Roles_ID = b.Roles_ID
        ) 
    e ON e.User_ID = c.User_ID

     ,wm_concat(pic_url) pic_url

    ,pic_url=STUFF((select '|'+pic_url from TB_ZYM_LOG_Image u where u.log_id=TB_ZYM_LOG_Image.log_id FOR xml path('')),1,1,'') 

    1查询所有@  替换成:

    2 SqlDatabase-->OracleDatabase

    3 top

    4 STUFF--->wm_concat

    5 dbo.  去除

    6 as 去除

    7 case when

    8 with  xxx as

    9 cast 

    10 isnull---》nvl

    11 GETDATE()  ---》  sysdate

    12 NEWID()-----SYS_GUID()

    13 null和’’(空字符串)是一个意思     https://www.cnblogs.com/memory4young/p/use-null-empty-space-in-oracle.html

     14 oracle 没有 [字段]  这种表达方式 去掉 中括号

    
    
    
  • 相关阅读:
    Vue 导出excel 自适应宽度
    .Net 5.0 项目数据库连接字符串
    .Net 5.0 从api下载文件到本地
    Oracle for 循环输出(游标提取)
    找到多个与名为“Home”的控制器匹配的类型
    让tomcat使用指定JDK
    .NetCore 3 单文件发布详解
    CentOS7 常用命令大全
    阿里云ECS CentOS 7.8 安装图形化桌面GNOME
    用命令禁用本地连接
  • 原文地址:https://www.cnblogs.com/mingjing/p/7993423.html
Copyright © 2011-2022 走看看