Re: calculating unique views based on ip, session_id

2011-02-23 Thread Cam Bazz
yes, this indeed solved my problem. thanks a bunch. On Wed, Feb 23, 2011 at 4:33 AM, wd wrote: > yes, ip_number and session_id should not be in group by clause. > > 2011/2/22 Viral Bajaria >> >> I am guessing the following query should work too: >> select item_sid, count(distinct ip_number, sess

Re: calculating unique views based on ip, session_id

2011-02-22 Thread wd
yes, ip_number and session_id should not be in group by clause. 2011/2/22 Viral Bajaria > I am guessing the following query should work too: > > select item_sid, count(distinct ip_number, session_id) from item_raw where > date_day = '20110202' group by item_sid; > > On Mon, Feb 21, 2011 at 9:42

Re: calculating unique views based on ip, session_id

2011-02-22 Thread Viral Bajaria
I am guessing the following query should work too: select item_sid, count(distinct ip_number, session_id) from item_raw where date_day = '20110202' group by item_sid; On Mon, Feb 21, 2011 at 9:42 PM, Cam Bazz wrote: > The query you have produced mulltiple item_sid's. > > This is rather what I h

Re: calculating unique views based on ip, session_id

2011-02-21 Thread Cam Bazz
The query you have produced mulltiple item_sid's. This is rather what I have done: select u.item_sid, count(*) cc from (select distinct item_sid, ip_number, session_id from item_raw where date_day='20110202') u group by u.eser_sid date_day is a partition and this produced the results i wanted,

Re: calculating unique views based on ip, session_id

2011-02-21 Thread wd
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 > Hello, > > So I have table of item vi

Re: calculating unique views based on ip, session_id

2011-02-21 Thread Ajo Fod
Oh, I think I see what you are getting at .. basically you are getting duplicate item_sids because they represent different views. ... try this: select item_sid, ip_number, session_id, count(*) from item_raw group by item_sid, ip_number, session_id; On Mon, Feb 21, 2011 at 11:54 AM, Cam Bazz

Re: calculating unique views based on ip, session_id

2011-02-21 Thread Cam Bazz
Hello, I did not understand this: when I do a: select item_sid, count(*) from item_raw group by item_sid i get hits per item. how do we join this to the master table? best regards, -c.b. On Mon, Feb 21, 2011 at 6:28 PM, Ajo Fod wrote: > You can group by item_sid (drop session_id and ip_numb

Re: calculating unique views based on ip, session_id

2011-02-21 Thread Ajo Fod
You can group by item_sid (drop session_id and ip_number from group by clause) and then join with the parent table to get session_id and ip_number. -Ajo On Mon, Feb 21, 2011 at 3:07 AM, Cam Bazz wrote: > Hello, > > So I have table of item views with item_sid, ip_number, session_id > > I know i