hi i have a table like this:
notifies
id,user_id
1,3
2,3
3,4
4,5
5,6
6,3
7,4
8,4
9,3
10,3
I have to create a query that group only the adjacent rows
So, the result of this example should be:
user_id
3
4
5
6
3
4
3
How can i do that? thanks
SELECT user_id
FROM notifies n
WHERE NOT
(
SELECT user_id
FROM notifies ni
WHERE ni.id < n.id
ORDER BY
id DESC
LIMIT 1
) <=> user_id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With