• tsql的执行顺序


    select * from  protype where id in (select top {0} id from (select top {1} id from protype where tid=" + id + " order by id desc) as t order by t.id desc) order by id desc

    请看上面的一条sql语句,经测试执行顺序为当然是在access中,因为,我觉得sqlserver中可能会不一样!
    ①select top {1} id from protype where tid=" + id + " order by id desc
    ②select top {0} id from (select top {1} id from protype where tid=" + id + " order by id desc) as t order by t.id desc)
    ③select * from  protype where id in (select top {0} id from (select top {1} id from protype where tid=" + id + " order by id desc) as t order by t.id desc) order by id desc
    括号的优先级还是体现出来了

    select * from  protype where id in (select top {0} id from (select top {1} id,sort from protype where tid=" + id + " order by sort desc) as t order by t.sort) order by sort desc
    这条语句竟然还能正常执行!

  • 相关阅读:
    Swift 扩展
    Swift 类型转换
    Swift 自动引用计数(ARC)
    Swift 可选链
    Swift 析构过程
    Swift 构造过程
    Swift 继承
    Swift 下标脚本
    Swift 方法
    Swift 属性
  • 原文地址:https://www.cnblogs.com/neve/p/1768804.html
Copyright © 2020-2023  润新知