Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / mohana krishna

select ename from employee
where eid = (select case mid when null then aid
else mid end mid
where eid=@aid
)


select m.name from employee e
join employee m on (m.aid=e.mid)

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is scd (slowly changing dimension)? : sql server analysis services, ssas

1000


What is the openxml statement in sql server?

1057


what are the different types of replication you can set up in sql server? : Sql server database administration

1014


What does set rowcount do?

894


Which trace flags are enabled in sql server?

1001


What is cube dimension? : sql server analysis services, ssas

998


What is the user of Primary key?

968


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?)

1851


What is the difference between ‘having’ clause and a ‘where’ clause?

1032


How to find a value in another dataset based on current dataset field (ssrs 2008 r2)?

169


What is triggers in ms sql server?

1102


What are filegroups in sql server?

1053


What do you mean by sql server agent?

981


Explain sql server service broker?

967


What are window functions in sql server?

997