问题:我要查询所有10点钟到13点钟的记录,具体日期是几几年几月的不管,这样的SQL要怎么写啊?另外怎么把查出的结果写入到一张新表中?时间 工号 电话2008-11-15 12:14 1446 519232712008-11-15 12:03 1443 589123092008-11-15 11:46 1452 608013042008-11-15 14:52 1480 615985832007-03-16 11:49 7002 618100822008-11-15 16:53 1463 621703262006-04-03 11:47 1447 63016481
select 时间,工号,电话 from 表名 where to_char(时间,'hh24') between '10' and '13';------这个是查询
写到新表中可以 create table_name(表名你可以自定义一个,但不要与库里重复) as select 时间,工号,电话 from 表名 where to_char(时间,'hh24') between '10' and '13';
--------------------补充----------------------- select datetime as 时间,agentid as 工号, ani as 电话 from report_call_hist where substr(to_date(datetime,'yyyy-mm-dd hh24:mi:ss'),13,2) between 10 and 13 如果你对我要查询所有10点钟到13点钟的记录,具体日期是几几年几月的不管,这样的SQL要怎么写啊?另外怎么把查出的结果写入到一张新表中?时间 工号 电话2008-11-15 12:14 1446 519232712008-11-15 12:03 1443 589123092008-11-15 11:46 1452 608013042008-11-15 14:52 1480 615985832007-03-16 11:49 7002 618100822008-11-15 16:53 1463 621703262006-04-03 11:47 1447 63016481这个问题有好的意见或
建议,请留言
|