user_id | value_1 | value_2
1 Text 1 3
1 Text 1 4
1 Text 1 5
1 Text 1 6
2 Text 2 3
2 Text 2 4
2 Text 2 5
2 Text 2 6
3 Text 3 3
3 Text 3 4
3 Text 3 5
3 Text 3 6
SELECT a.user_id, a.value_1, b.value_2 FROM table a LEFT JOIN table b ON a.user_id = b.user_id AND a.type = 'remove' and a.action_type = 3 AND b.type = 'give' AND b.action_type = 22 ORDER BY created_timestamp DESC LIMIT 50;