How to grouping 'Code' with columns 'Or_1', 'And_1', 'Or_2' and 'And_2'.
This is a 1 condition which results in 3 data sets from the Or_1 condition, where the sequence 1,2,3 means Can divide data into 3 sets. The conditions And_1, Or_2 and And_2 do not apply because the value is 0.
Expected result :
A00660
A00762
A00763
with 3 conditions, starting from Or_1 first In which the first order has no other condition (And_1, Or_2 and And_2 is 0), the result is A00660. The second order has 3 sequences of And_1 conditions, the first order gets A00762, the second order gets A00763, but the third order has the Or_2 condition. Also, A00764 or A00765 can be selected. Therefore, the result is 2 sets: (A00762,A00763,A00764) and (A00762,A00763,A00765).
Expected result :
A00660
A00762,A00763,A00764
A00762,A00763,A00765
Expected result :
A00660
A00762,A00763,A00764
A00762,A00763,A00765,A00766
A00762,A00761,A00764
A00762,A00761,A00765,A00766
Thank you in advance.


