hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wd ...@wdicc.com>
Subject Re: calculating unique views based on ip, session_id
Date Tue, 22 Feb 2011 02:32:01 GMT
May be
select item_sid, count(distinct ip_number, session_id) from item_raw group
by item_sid, ip_number, session_id (I've not test it, maybe it should be
concat(ip_number, session_id) instead of ip_number, session_id )
is what you want.

2011/2/21 Cam Bazz <cambazz@gmail.com>

> Hello,
>
> So I have table of item views with item_sid, ip_number, session_id
>
> I know it will not be that exact, but I want to get unique views per
> item, and i will accept ip_number, session_id tuple as an unique view.
>
> when I want to query just item hits I say: select item_sid, count(*)
> from item_raw group by item_sid;
>
> but if I say:
>
> select item_sid, count(*) from item_raw group by item_sid, ip_number,
> session_id;
>
> it will give me duplicate item sids.
>
> how can I query per unique tuple of ip_number, session_id per item_sid?
>
> best regards,
> c.b.
>

Mime
View raw message