zoukankan      html  css  js  c++  java
  • 设置库位排序规则

    CREATE TABLE #tb
           (
             id INT IDENTITY ,
             LocationName VARCHAR(24) ,
             LocationIndex INT NULL
           )

    INSERT  INTO #tb
            (
              LocationName
            )
            SELECT  '1015-02A01'
            UNION
            SELECT  '1015-01A01'
            UNION
            SELECT  '1016-04A01'
            UNION
            SELECT  '1016-05A01'
            UNION
            SELECT  '1017-01A01'
            UNION
            SELECT  '1010-01A01'
            UNION
            SELECT  '1016-02A01'
            UNION
            SELECT  '1016-07A01'
            UNION
            SELECT  '1015-03A01'
            UNION
            SELECT  '1015-04A01'
            


    SELECT  * ,
            new_id = row_number() OVER ( ORDER BY CASE WHEN LEFT(LocationName, 2) = 10
                                                       THEN LEFT(LocationName, 4)
                                                  END DESC
                                                   , CASE WHEN LEFT(LocationName,
                                                                  4) IN ( '1015',
                                                                  '1016' )
                                                          THEN SUBSTRING(LocationName,
                                                                  6, 2) % 2
                                                     END, SUBSTRING(LocationName,
                                                                  6, 2) )
    FROM    #tb WITH ( NOLOCK )

  • 相关阅读:
    命令提示符窗口adb shell 执行sqlite命令时进入 ...> 状态如何退出
    通过android studio 浏览模拟器中文件
    vim快捷键参考
    快速体验openstack-用devstack安装openstack
    css靠左,靠右
    全国-城市-百度地图中心点坐标
    java_dom4j解析xml
    December 31st, Week 53rd Tuesday, 2019
    December 28th, Week 52nd Saturday, 2019
    December 21st, Week 51st Saturday, 2019
  • 原文地址:https://www.cnblogs.com/pato/p/3546192.html
Copyright © 2011-2022 走看看