表中数据:年度 月份 小时 分钟
Nendo Gatsudo Jikan Funkan
17 1 148 50
17 2 156 40
17 3 172 20
17 4 156 40
17 5 148 50
17 6 172 20
17 7 156 40
17 8 172 20
17 9 156 40
17 10 156 40
17 11 156 40
17 12 156 40 要求返回结果: Nendo Gatsudo Jikan Funkan
17 4 156 40
17 5 148 50
17 6 172 20
17 7 156 40
17 8 172 20
17 9 156 40
17 10 156 40
17 11 156 40
17 12 156 40
17 1 148 50
17 2 156 40
17 3 172 20
也就是:表里面数据的月份从1月份到12月份
返回结果,要求从4月份到来年的3月份
请赐教!!!
Nendo Gatsudo Jikan Funkan
17 1 148 50
17 2 156 40
17 3 172 20
17 4 156 40
17 5 148 50
17 6 172 20
17 7 156 40
17 8 172 20
17 9 156 40
17 10 156 40
17 11 156 40
17 12 156 40 要求返回结果: Nendo Gatsudo Jikan Funkan
17 4 156 40
17 5 148 50
17 6 172 20
17 7 156 40
17 8 172 20
17 9 156 40
17 10 156 40
17 11 156 40
17 12 156 40
17 1 148 50
17 2 156 40
17 3 172 20
也就是:表里面数据的月份从1月份到12月份
返回结果,要求从4月份到来年的3月份
请赐教!!!
order by Nendo asc,
abs(Gatsudo-4) asc
Nendo Gatsudo Jikan Funkan
17 4 156 40
17 3 172 20
17 5 148 50
17 6 172 20
17 2 156 40
17 7 156 40
17 1 148 50
17 8 172 20
17 9 156 40
17 10 156 40
17 11 156 40
17 12 156 40
select * from 表
order by Nendo asc,
(case when Gatsudo<4 then Gatsudo+12 else Gatsudo end ) asc
我只是取出了一年的数据,当然还有15,16,18,19等等
where Gatsudo>3 order by Gatsudo asc
union
select * from 表
where Gatsudo<4 order by Gatsudo asc)
order by Nendo asc
我写的苯
select * from 表 A order by case Gatsudo when 1 then 20+b when 2 then 20+b when 3 then 20+b else Gatsudo end
这里的数值13为大于或者等于最大月份12的任何数值即可.
是不是给TMD小RB做?
union
select * from 表 where (Gatsudo<4 and Nendo=当年年度+1)
的方法问题解决。
select * from 表 A order by (A.Gatsudo+9)%13不过在ACCESS中要改成这样:
select * from 表 A order by (A.Gatsudo+9) mod 13
非常感谢!