C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » SQL Server »

How to write a Query on table


Posted Date: 06 Nov 2009      Posted By: janardhanReddy      Member Level: Silver     Points: 1   Responses: 3



hi all,
i have one table.it have primarykey and Referencekey
table columns are
empid ename mgrId
1 janu 3
2 reddy 3
3 cnu 1
4 banu 2
5 ravi 1

so here i want to get empname and corresponding managername

ex: janu cnu
reddy cnu
cnu janu
banu reddy
ravi janu

how can i get this?.
thanks in advance





Responses

Author: Reach2Shaik    06 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hi Janardhan,

try this

SELECT e.ename,m.mgrName
FROM Employees e
INNER JOIN Managers m ON m.mgrID = e.mgrID

Don't forget to rate this answer, if it is helpful...
Regards Shaik



Author: janardhanReddy    06 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

hi shaik,
here i have only one table that is emp
but you are taken two tables



Author: Shameer    08 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

PLease specify the reference table also, then i can help you


Post Reply
You must Sign In to post a response.
Next : Sql 2005
Previous : Create Table
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use