SELECT count( A.tid ) , A.uid
FROM tag_recordlog A, (

SELECT id, max( dateline )
FROM tag_recordlog
WHERE uid >128
AND uid <168
AND dateline > 1405375200
AND dateline <1408053600
GROUP BY tid
)B
WHERE A.id = B.id
GROUP BY uid
LIMIT 0 , 30