set countt = PAGE_ * 5 - 5;
set @data = (select JSON_ARRAYAGG(JSON_OBJECT('id', room_participants.id, 'isAdmin', room_participants.isAdmin, 'userId', room_participants.userId, 'joinTime', room_participants.joinTime, 'leftTime', room_participants.leftTime, 'status', room_participants.status, 'kickTime', room_participants.kickTime, 'displayName', users.displayName, 'phone', users.phone, 'created', created))
from room_participants
LEFT JOIN users ON room_participants.userId = users.id
WHERE room_participants.roomId = ROOMID_ LIMIT 5 OFFSET countt);
I need the above query to display only limit to 5 data in json_arrayagg format, but its return me the whole data without limit it to 5. What is the problem with my query?