Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如06-02-24052012-22860-A
06-02-24052012-22860-A
大家好,以上是我的主键,我想从顶部的最早日期,底部的最新日期排序。
06-02- DDMMYYYY-22860-A
DDMMYYYY
所有其他数字都是随机的,日期位于中心。无论如何我可以用这样的主键进行排序吗?
用 - 分割,然后使用正则表达式匹配日期
使用 MS Access SQL:
SELECT t.AKey, DateSerial(Mid([AKey],11,4),Mid([AKey],9,2),Mid([AKey],7,2)) AS DSort FROM table t ORDER BY DateSerial(Mid([AKey],11,4),Mid([AKey],9,2),Mid([AKey],7,2)) AS DSort