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
What is the use of keyword with encryption.
What is the default value of an integer data type in sql server 2005?
How optimize sql query with multiple joins in sql server?
What is a virtual table in sql?
How can I know what locks are running on which resource?
Explain what are the restrictions that views have to follow? : SQL Server Architecture
How to create nested stored procedure?
What is amo? : sql server analysis services, ssas
How to use clusters?
Can we use where clause with group by?
What is the difference between push and pull subscription? : sql server replication
What do you mean by recursive stored procedure?
What are the different types of lock modes in sql server 2000?
What is 2nf normalization?
how do you determine the Load performance of any query in sql server {example how do u determine performance of a select stmnt which returns Dynamically many no of records ... some times 100,1000,10000 etc., }