我一张表里面有
车次   到点
1      8:00
2      9:00
3      10:00
4      11:00比如现在是8:30,那我的排序查询出来就是2341
如果是9:30,那就是3412。
请问这个该如何写sql代码!

解决方案 »

  1.   


    (SELECT 车次 FROM table Where 到点
     >'02:00:00' order by 到点 asc)
    union all
    (select 车次 From table where 到点
    <'02:00:00' order by 到点 desc)
      

  2.   

    改:(SELECT 车次 FROM table Where 到点>'02:00:00' Group by 到点)
    union all
    (select 车次 From table where 到点<'02:00:00' Group by 到点)
      

  3.   

    (SELECT 车次 FROM table Where 到点
     >now() order by 到点 asc)
    union all
    (select 车次 From table where 到点
    <now() order by 到点 desc)无法实现。请继续指导!
      

  4.   

    (SELECT 车次 FROM table Where 到点>CONVERT(varchar(100), now(), 24) Group by 到点)
    union all
    (select 车次 From table where 到点<CONVERT(varchar(100), now(), 24) Group by 到点)
      

  5.   


    SELECT 车次
    FROM 表名
    ORDER BY Date()+到点-((Date()+到点)<Now())
      

  6.   

    我用的是ACCESS数据库,报convert没有定义
      

  7.   


    (SELECT 车次 FROM table Where 到点>format(now, "hh:mm") Group by 到点)
    union all
    (select 车次 From table where 到点<format(now, "hh:mm") Group by 到点)
      

  8.   

    (SELECT 车次 FROM table Where 到点>format(now, "hh:mm") Group by 到点)
    union all
    (select 车次 From table where 到点<format(now, "hh:mm") Group by 到点)
    试图执行的查询中不包含作为合计函数一部分的特定表达式“车次”
      

  9.   


    (SELECT 车次 FROM table Where 到点>format(now, "hh:mm") Group by 到点,车次)
    union all
    (select 车次 From table where 到点<format(now, "hh:mm") Group by 到点,车次)