[EMAIL PROTECTED] (Greg Stark) writes:
Geoff Caplan [EMAIL PROTECTED] writes:
Hi folks,
Sorry to ask a newbie SQL question but I'm struggling...
There's no efficient way to write this in standard SQL. However Postgres has
an extension DISTINCT ON that would do it:
select
Hi folks,
Sorry to ask a newbie SQL question but I'm struggling...
I have a website clickstream log:
request_id session_id sequence_num url
100 xxx 1 /foo
101 xxx 2 /bar
102 xxx 3 /hoo
103 yyy
Geoff Caplan [EMAIL PROTECTED] writes:
Hi folks,
Sorry to ask a newbie SQL question but I'm struggling...
There's no efficient way to write this in standard SQL. However Postgres has
an extension DISTINCT ON that would do it:
select url,count(*)
from (select distinct on (session_id)
Greg,
GS There's no efficient way to write this in standard SQL.
GS However Postgres has an extension DISTINCT ON that would
GS do it:
Works as advertised - many thanks! I'd missed the DISTINCT
ON extension...
This really is a great list - you've saved me a couple of
hours of agony, I suspect.