MySQL Query to get count of unique values?
Posted
by RD
on Stack Overflow
See other posts from Stack Overflow
or by RD
Published on 2010-05-14T06:43:53Z
Indexed on
2010/05/14
6:54 UTC
Read the original article
Hit count: 185
Hits Table:
hid | lid | IP
1 | 1 | 123.123.123.123
2 | 1 | 123.123.123.123
3 | 2 | 123.123.123.123
4 | 2 | 123.123.123.123
5 | 2 | 123.123.123.124
6 | 2 | 123.123.123.124
7 | 3 | 123.123.123.124
8 | 3 | 123.123.123.124
9 | 3 | 123.123.123.124
As you can see, there following are the unique hits for the various lid:
lid 1: 1 unique hit
lid 2: 2 unique hits
lid 3: 1 unique hit
So basically, I need a query that will return the following:
lid | uhits |
1 | 1 |
2 | 2 |
3 | 1 |
Anybody know how to get that?
© Stack Overflow or respective owner