Alireza
Alireza

Reputation: 5673

mysql find duplications

this is the table

fid  uid  time
12   34   1
1    34   2
15   34   5
1    33   10
12   33   10
1    33   12
13   33   15
16   34   123
22   32   453
1    32   456
1    33   457
1    32   460

now I want to count the number of each uid where time is >9 and fid=1 like this

uid     number of duplications
33      3
32      2

Upvotes: 0

Views: 43

Answers (1)

AnAmuser
AnAmuser

Reputation: 1895

SELECT uid, COUNT(*) FROM table WHERE fid=1 AND `time` > 9 GROUP BY uid

Upvotes: 8

Related Questions