query to select where count is less than or greater than 10 using group by in mysql

SELECT user_id,count(*) as usercnt FROM `user_activity` WHERE 1 group by user_id having usercnt > 10;
SELECT user_id,count(*) as usercnt FROM `user_activity` WHERE 1 group by user_id having usercnt <= 1;
SELECT user_id,count(*) as usercnt FROM `user_activity` WHERE 1 group by user_id having usercnt <> 10;
SELECT user_id,count(*) as usercnt FROM `user_activity` WHERE 1 group by user_id having usercnt > 10 and usercnt < 100;
SELECT user_id,count(*) as usercnt FROM `user_activity` WHERE 1 group by user_id having usercnt > 10 or usercnt < 100;

Discover more from Soa Technology | Aditya Website Development Designing Company

Subscribe to get the latest posts sent to your email.




Leave a Reply

Discover more from Soa Technology | Aditya Website Development Designing Company

Subscribe now to keep reading and get access to the full archive.

Continue reading