mysql - SQL Select Query Tree -
i have table called admin following columns:
admin_id, admin_table, unit_id, unit_table
i beginning search see if admin on unit directly or further down tree. starting off admin_id, admin_table, unit_id , unit_table. because admin may control unit on unknown level of descendants.
i need change admin_id , admin_table if unit controlled admin not searched unit , admin on unit.
how using mysql database?
guys because not understand doesn't mean vote down. imagine if php. answered myself below:
select @uid:=unit_id 'unit_id', @utb:=unit_table 'unit_table' admin inner join (select @uid:='".$id."', @utb:='".$table."') tmp admin_id=@uid , admin_table=@utb')
Comments
Post a Comment