Skip to content

Commit 53d8091

Browse files
committed
query updated
1 parent eaa5150 commit 53d8091

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11

2-
3-
4-
select v.post_id, count(distinct v.clientip)
2+
select date_trunc('day', v.createdat) as dt, v.post_id, p.title, count(distinct v.clientip) as count
53
from visits as v
6-
left join seo_robots_agents as ra
7-
on case when ra.isregexp then lower(nullif(v.useragent,'')) ~* lower(ra.useragent)
8-
else lower(nullif(v.useragent,'')) like concat('%',lower(ra.useragent),'%') end
4+
left join seo_robots_agents as ra
5+
on case when ra.isregexp then lower(nullif(v.useragent,'')) ~* lower(ra.useragent)
6+
else lower(nullif(v.useragent,'')) like concat('%',lower(ra.useragent),'%') end
7+
inner join posts as p
8+
on v.post_id = p.id
99
where v.isadmin = false
10-
and ra.id isnull
11-
group by v.post_id
10+
and ra.id isnull
11+
group by date_trunc('day', v.createdat), v.post_id, p.title
12+
order by date_trunc('day', v.createdat), v.post_id

0 commit comments

Comments
 (0)