0

我有一些数据

SMMP0220113042212
SMMP0220113042211
SMMP0220113042210
SMMP022011304231
SMMP022011304229
SMMP022011304228

如果“SMMP02201”是商店代码,“130422”是日期(yymmdd),我必须如何创建查询,之后该代码是一天的增量交易

SMMP022011304231
SMMP0220113042212
SMMP0220113042211
SMMP0220113042210
SMMP022011304229
SMMP022011304228
4

1 回答 1

1
SELECT code
FROM table
ORDER BY substr(code, 1, 9), SUBSTR(code, 10, 6) DESC, CAST(substr(code, 16) AS DECIMAL) DESC;

小提琴

于 2013-04-23T04:27:50.220 回答