1.递归sql语句
select SPFL from TB_SPFL connect by prior SPFL = SJFL start with SPFL = 103
2.根据时间进行统计
select to_char(JLSJ, 'YYYY-MM-dd') as a, count(*) as LLS, count(distinct FWIP)as IPSL from TB_LYTJ group by to_char
(JLSJ, 'YYYY-MM-dd') order by a DESC;
3.根据时间进行统计
select distinct to_char(bb.JLSJ, 'YYYY-MM-dd'),
(select count(distinct FWIP) from tb_lytj a where to_char(a.JLSJ, 'YYYY-MM-dd')=to_char(bb.JLSJ, 'YYYY-MM-dd') ) as ip_num,
(select count(*) from tb_lytj c where to_char(c.JLSJ, 'YYYY-MM-dd')=to_char(bb.JLSJ, 'YYYY-MM-dd') ) as num
from tb_lytj bb
where bb.JLSJ >= to_date('2011-12-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
and bb.JLSJ <= to_date('2012-01-05 23:59:59', 'YYYY-MM-DD HH24:MI:SS')
select SPFL from TB_SPFL connect by prior SPFL = SJFL start with SPFL = 103
2.根据时间进行统计
select to_char(JLSJ, 'YYYY-MM-dd') as a, count(*) as LLS, count(distinct FWIP)as IPSL from TB_LYTJ group by to_char
(JLSJ, 'YYYY-MM-dd') order by a DESC;
3.根据时间进行统计
select distinct to_char(bb.JLSJ, 'YYYY-MM-dd'),
(select count(distinct FWIP) from tb_lytj a where to_char(a.JLSJ, 'YYYY-MM-dd')=to_char(bb.JLSJ, 'YYYY-MM-dd') ) as ip_num,
(select count(*) from tb_lytj c where to_char(c.JLSJ, 'YYYY-MM-dd')=to_char(bb.JLSJ, 'YYYY-MM-dd') ) as num
from tb_lytj bb
where bb.JLSJ >= to_date('2011-12-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
and bb.JLSJ <= to_date('2012-01-05 23:59:59', 'YYYY-MM-DD HH24:MI:SS')