i am using mysql, problem is , i have a group id like '101' and i want to get all device id's which is under his account and also those id's which are under its sub groups for eg: if group id is 101: then device_id should be 1. 44444 2. 33333 3. 55555
Table : Groups --------------------------------------------------------------------------------------
group_id | parent_id | group_name
--------------------------------------------------------------------------------------
101 | null | matrix
102 | 101 | sub_matrix1
103 | 101 | sub_matrix2
104 | null | abc
105 | 104 | sub_abc
106 | null | mega
---------------------------------------------------------------------------------------
Table : Devices
--------------------------------------------------------------------------------------
device_id | group_id | device_name
--------------------------------------------------------------------------------------
44444 | 101 | m1
33333 | 101 | m1
22222 | 102 | m1
55555 | 103 | m1
88888 | 104 | m1
---------------------------------------------------------------------------------------