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
Write a SQL query to make a column as unique?
How and why use sql server?
What is the difference between inner join and equi join?
What is a view in sql?
How do you delete a trigger?
How many types of dimensions are there and what are they? : sql server analysis services, ssas
How will you go about resolving deadlocks?
What are the basic functions for master, msdb, model, tempdb databases?
Insert syudents details in table.Current system date &time insert into joining time.How do insert?( in sysdate only return current system date how do add time?)
How to insert data into an existing table?
What does the on delete cascade option do?
What are sql server procedures?
You have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation?
Mention the different types of triggers?
What is t-sql script to take database offline – take database online.