#上下级

单纯MYSQL递归查询上下级关系

查询id=6的所有父级SELECTID.level,DATA.*FROM(SELECT@idas_id,(SELECT@id:=parent_idFROMtable1WHEREid=@id)as_pid,@l:=@l+1aslevelFROMtable1,(SELECT@id:=6,@l:=0)bWHERE@id>...