I have a table looking like a block history:
id user_id admin_id when_blocked block reason
1 1 4 05.05.17 TRUE flood
2 1 4 06.05.17 FALSE
3 1 4 07.05.17 TRUE flood
4 1 4 08.05.17 FALSE
5 1 5 09.05.17 TRUE cheating
Where block column means block action (TRUE as block, FALSE as unblock). New block record may appear, only if previously user was unblocked. Therefore, records with same user_id always alternate between TRUE and FALSE.
The problem:
I want to get table looking like:
user_id admin_id when_blocked reason when_unblocked
1 4 05.05.17 flood 06.05.17
1 4 07.05.17 flood 08.05.17
1 5 09.05.17 cheating null
Is there a possibility to implement this resulting table?
Thanks.
block = TRUEalways precedeblock = FALSEin date order? Can you ever getTRUE, TRUE, FALSEorFALSE, FALSE, FALSE? Or is it always nice and perfectly clean, always starting withTRUEand then always alternating?