M
Microsoft
I've a table of users like this
id_user id_ref flg_enabled
1 0 1
2 1 1
3 1 0
4 2 1
id_user 1 created id_user 2 and 3
id_user 2 created id_user 4
This rule can by infinite
I need a recursive function that tells me when a user and all his "fathers"
are enabled
If one of its father is disabled (flg_enabled=0) the function have to return
0
If all the father (till id_ref=0) are enabled (flg_enabled=1) the function
have to return 1
function is_enabled(id_user)
.....
End Function
Can you please help me?
Thanks
id_user id_ref flg_enabled
1 0 1
2 1 1
3 1 0
4 2 1
id_user 1 created id_user 2 and 3
id_user 2 created id_user 4
This rule can by infinite
I need a recursive function that tells me when a user and all his "fathers"
are enabled
If one of its father is disabled (flg_enabled=0) the function have to return
0
If all the father (till id_ref=0) are enabled (flg_enabled=1) the function
have to return 1
function is_enabled(id_user)
.....
End Function
Can you please help me?
Thanks