table:employee
EID ENAME MID(manager ids)
101 rama null
102 sita 101
103 siva 101
104 ganesh 103
. . .
. . .
for 103 ID the manager ID is 101(RAMA) and for 104 manager
is SIVA
if i give employee id (EID) you have to tell the manager for
that EID write query?
eample:if i give 102 .The query output should be manager for
102 ID that it should print RAMA as output

Answer Posted / samba shiva reddy . m

this will also works for u change is id in inner join

select emp1.ename from employee emp1
inner join employee emp
on emp1.eid=emp.mid
where emp.eid=102

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is indexing in sql server with example?

515


What is implicit cursors?

547


How can we improve performance by using SQL Server profiler?

571


Do you know what are pages and extents? : SQL Server Architecture

542


What is sql server profiler trace data file?

579






What is tablesample?

566


What is the standby server?

512


What are the system database in sql server 2005?

548


What does indexation mean?

522


How to display a past time in days, hours and minutes?

565


How data can be copied from one table to another table?

507


What is nested transaction?

532


How to use go command in "sqlcmd"?

640


How do I uninstall sql server 2014?

514


What is inline variable assignment?

593