Click Tracking

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Click Tracking

Post by JayBird »

I am counting as best i canthe unique hits to specific jobs on a job site i am developing.

I ha

Code: Select all

ID  SessionID                          Date			userIP		    jobID
1	1a4012cae0564bd1fd1ba28a59617cc1	1148567929	81.153.130.30	1
2	1a4012cae0564bd1fd1ba28a59617cc1	1148567954	81.153.130.30	1
3	1a4012cae0564bd1fd1ba28a59617cc1	1148568004	81.153.130.30	1
4	650feced17da4214d677522f00b447a8	1148568064	54.121.192.56	1
5	1a4012cae0564bd1fd1ba28a59617cc1	1148568316	81.153.130.30	2
6	1a4012cae0564bd1fd1ba28a59617cc1	1148568508	81.153.130.30	1
Can i get the total unique hits for each individual job using just one query!?

If so, roughly what would the query look like.

The result for the above sample data should be

Job 1 = 2 unique hits
Job 2 = 1 unique hit

Thanks
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Think i may have sorted it myself. Think this does the trick

Code: Select all

SELECT COUNT(DISTINCT(`sessionID`)) as `uniqueHits`, `jobID` from `database`.`clickStats` GROUP BY `jobID`
Post Reply