当前位置: 代码迷 >> Oracle开发 >> 求SQL话语。
  详细解决方案

求SQL话语。

热度:96   发布时间:2016-04-24 07:26:15.0
求SQL语句。。。
麻烦先看看要求,上个帖子已经结贴了,但是要求又增加了一点。。

http://topic.csdn.net/u/20120531/14/b685e5c2-9e02-4a88-b0d6-76e7ced608ad.html

要求在我最后回复的楼层里。。

------解决方案--------------------
测试数据:

SQL code
create table tab_test asselect 1 as can_use, to_date('2012-01-14 0:10:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '繁忙' as des,''CAR_USE_MODE,'' USE_NO from dualunion allselect 1 as can_use, to_date('2012-01-14 0:20:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '繁忙' as des,'','' from dual union allselect 1 as can_use, to_date('2012-01-14 0:30:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '繁忙' as des,'','' from dual union allselect 1 as can_use, to_date('2012-01-14 0:40:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '繁忙' as des,'','' from dual union allselect 1 as can_use, to_date('2012-01-14 0:50:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '繁忙' as des,'','' from dual union allselect 1 as can_use, to_date('2012-01-14 1:00:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '繁忙' as des,'','' from dual union allselect 0 as can_use, to_date('2012-01-14 1:10:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '空闲' as des,'租赁','HT12011600402' from dual union allselect 0 as can_use, to_date('2012-01-14 1:20:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '空闲' as des,'租赁','HT12011600402' from dual union allselect 0 as can_use, to_date('2012-01-14 1:30:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '空闲' as des,'租赁','HT12011600402' from dual union allselect 0 as can_use, to_date('2012-01-14 1:40:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '空闲' as des,'租赁','HT12011600402' from dual union allselect 0 as can_use, to_date('2012-01-14 1:50:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '空闲' as des,'租赁','HT12011600402' from dual union allselect 0 as can_use, to_date('2012-01-14 2:00:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '空闲' as des,'租赁','HT12011600402' from dual union allselect 1 as can_use, to_date('2012-01-14 2:10:00', 'yyyy-MM-dd HH24:mi:ss') as c_date , '繁忙' as des,'租赁','HT12011600402' from dual;
------解决方案--------------------
这个还好 偶上次回复的那个才是体力活 一天多 就为了回复一个sql
  相关解决方案