Hi All -
I have a database set up with several columns, but only need to access 2 of them:
session (the users session id number)
event (the event that occurred)
event contains only numbers which are triggered when a visitor performs a certain action (eg. Clicking "Sign up" would send an event "10" to the database).
I want to grab every event from a distinct session. but i do not want to grab duplicate events for that session. For example, if a user clicks sign up 3 times, event 10 for that session would be in the database 3 times. I want to just grab it one time.
I have the following code, but it seems to grab every event:
SELECT
COUNT(DISTINCT session) AS e_0,
sum(case when event LIKE '2' then 1 else 0 end) AS e_1,
sum(case when event LIKE '3' then 1 else 0 end) AS e_2
FROM table_name
WHERE page LIKE 'page1'
CAN SOMEONE PLEASE HELP?! IM AM DESPERATE!
Thanks in advance
-Matt