SQL语句,一个时间字段sendtime,
我现在只能做好日、dep的排序:
是select.... order by to_date(sendtime),dep asc;现在想先按日排序,在同一日里按照部门dep分组排序,同一个部门多条数据再按照小时分钟秒的顺序排序显示,如何做?
(我这样写不正确:select.... order by to_date(sendtime),to_time(sendtime),dep asc;)
我现在只能做好日、dep的排序:
是select.... order by to_date(sendtime),dep asc;现在想先按日排序,在同一日里按照部门dep分组排序,同一个部门多条数据再按照小时分钟秒的顺序排序显示,如何做?
(我这样写不正确:select.... order by to_date(sendtime),to_time(sendtime),dep asc;)
from **
where **
order by trunc(senddate,'DD'),dept,to_char(senddate,'hh24:mis:ss')
order by trunc(sendtime,'yyyymmdd'),dep,sendtime;