Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. SELECT GROUP_CONCAT(lv SEPARATOR ',') AS 'Reports' FROM (
  2. SELECT @pv:=(SELECT GROUP_CONCAT(JobInfo.EmpID SEPARATOR ',') FROM JobInfo WHERE ReportsToEmpID IN (@pv)) AS lv FROM JobInfo
  3. JOIN
  4. (SELECT @pv:=$empID)tmp
  5. WHERE ReportsToEmpID IN (@pv)) a;
  6.  
  7. [2] => array( <---- this is you
  8. [5] => array( <---- this is a person directly beneath you
  9. [0] => 263
  10. [1] => 152 <----- these are people below the person directly beneath you,
  11. [2] => 33 it doesn't matter how far down they are.
  12. [166] => array( <----- this is another person directly beneath you
  13. [0] => 243
  14. ),
  15. [199] => array( <----- this is another person directly beneath you
  16. [0] => 43
  17. [1] => 44
  18. [2] => 45 <----- these are people below the person directly beneath you,
  19. [3] => 46 it doesn't matter how far down they are.
  20. [4] => 47
  21. [5] => 48
  22. )
  23. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement