I have a location table now I have to keep only 100 record for each customer and have to move rest of them to another server.
using this query We can get customers list
SELECT user_id FROM user_location_history WHERE (TIMESTAMPDIFF(DAY,FROM_UNIXTIME(location_date/1000),SYSDATE()) < 30) GROUP BY user_id HAVING COUNT(1) < 100
Now suppose we have a list of customer like
I am trying to write a single query to get all the record for each customer which is greater then 100.
- 125452
- 412555
- 554114
- 258471
Please suggest ....