ip 중복 제거및 특정 날짜
select
distinct ip, ip compareIp , agent, brower, os, countrycode, countryname, region, regionname, city
, postalcode, latitude, LONGITUDE
from TBL_WEBLOG
where
regdate between to_date('20170206', 'YYYYMMDD') and to_date('20170208', 'YYYYMMDD')
) A order by regdate desc
번호 및 중복 제거후 ip, 마지막 regdate, 마지막 idx 번호
select rownum,
(select count(*) from tbl_weblog where ip=compareIp ) ipcount ,
(select max(regdate) from tbl_weblog where ip=compareIp ) regdate,
(select max(idx) from tbl_weblog where ip=compareIp ) idx ,
A.*
from
(
select
distinct ip, ip compareIp , agent, brower, os, countrycode, countryname, region, regionname, city
, postalcode, latitude, LONGITUDE
from TBL_WEBLOG
where
regdate between to_date('20170206', 'YYYYMMDD') and to_date('20170208', 'YYYYMMDD')
) A order by regdate desc
) B
페이징 처리를 위한 rn
select * from (
select rownum as rn, B.* from
(
select rownum,
(select count(*) from tbl_weblog where ip=compareIp ) ipcount ,
(select max(regdate) from tbl_weblog where ip=compareIp ) regdate,
(select max(idx) from tbl_weblog where ip=compareIp ) idx ,
A.*
from
(
select
distinct ip, ip compareIp , agent, brower, os, countrycode, countryname, region, regionname, city
, postalcode, latitude, LONGITUDE
from TBL_WEBLOG
where
regdate between to_date('20170206', 'YYYYMMDD') and to_date('20170208', 'YYYYMMDD')
) A order by regdate desc
) B
) where rn BETWEEN #{start} and #{end}
select * from (
select rownum as rn, B.* from
(
select rownum,
(select count(*) from tbl_weblog where ip=compareIp ) ipcount ,
(select max(regdate) from tbl_weblog where ip=compareIp ) regdate,
(select max(idx) from tbl_weblog where ip=compareIp ) idx ,
A.*
from
(
select
distinct ip, ip compareIp , agent, brower, os, countrycode, countryname, region, regionname, city
, postalcode, latitude, LONGITUDE
from TBL_WEBLOG
where
regdate between to_date('20170206', 'YYYYMMDD') and to_date('20170208', 'YYYYMMDD')
) A order by regdate desc
) B
) where rn BETWEEN #{start} and #{end}
댓글 ( 4)
댓글 남기기