i've stuck in mysql query. i've a employee table whose fields are id, name, bossid and bossid is parent id of employee.
How i write the query to print the data in this format
id name boss
1 rajesh rajesh
2 vijay rajesh
3 ravi vijay
Just join the table with itself:
Select t1.id as id ,t1.name as Name ,t2.name as boss from employee t1 join employee t2 on t1.bossid=t2.id