猫南北i 2022-09-29 13:14 采纳率: 50%
浏览 155
已结题

sql语句,withas语句转换为mysql可识别的sql语句

  • [ 数据库由sqlserver更换为mysql,withas不能使用,求指点,转换为mysql可以用的sql语句]
WITH allSorts AS (
 SELECT s.*
            FROM Sort s
            where s.isDel = 0
              and s.kid = #{sortKid}
            UNION ALL
            SELECT s.*
            FROM Sort s
                     INNER JOIN allSorts a ON a.parentId = convert(varchar (36), s.kid)
            WHERE s.isdel = 0
        )
        select c.*
        from ContractInfo c
                 inner join SectionInfo s on c.sectionIds = convert(varchar (36), s.kid)
                 inner join (select top 1 * from allSorts where allSorts.isdel = 0 ORDER BY iid asc) a
                            on a.parentId = convert(varchar (36), s.kid)
        where c.isdel = 0
          and s.isdel = 0
          and c.contractType = 4


  • 写回答

10条回答 默认 最新

  • 燕少༒江湖 2022-09-29 13:36
    关注

    你的mysql 什么版本?,用这个sql查询一下:

    select version();
    
    
    评论

报告相同问题?

问题事件

  • 系统已结题 10月7日
  • 修改了问题 9月29日
  • 创建了问题 9月29日

悬赏问题

  • ¥15 怎么获取下面的: glove_word2id.json和 glove_numpy.npy 这两个文件
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug