Question : SQL query

I have a table which has many records including user_id, activity_type

now i want to find the user_id which returns maximum records with activity_type = 2

Answer : SQL query

SELECT MAX(a.iCount)
FROM
(SELECT user_id, COUNT(user_id) as iCount
FROM Table1
WHERE activity_count=2
GROUP BY user_id) as a
Random Solutions  
 
programming4us programming4us