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 / saravanan p

Declare @eid int
Set @eid=2

select 'The manager for employee id '+convert(varchar
(50),e2.eid)+' is '+e1.ename from emp e1,emp e2
where e1.eid=e2.mid and e2.eid=@eid

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sql server locking?

937


How to count rows with the count(*) function in ms sql server?

952


Write a SQL query to make a column as unique?

963


What are the differences between web role and worker role?

122


Explain a differential backup?

949


What is filestream?

945


If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?

918


What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?

954


How to defragment indexes with alter index ... Reorganize?

1028


What is wrong with sql server client libarary dll, ntwdblib.dll?

997


What is join query?

840


What is normalization according to you and explain its different levels?

900


List few advantages of stored procedure.

928


Explain security with sql azure?

186


We are updating a field in sql and alter the row also.after giving the commit command the system is crashed.what will happen to the commands given,whether it will update and alter the table or not?

1328