names from id results | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

names from id results

i have a query that returns successful results getting the distinct id from a enquireies table as follows:
select DISTINCT enq.enqid, enq.empid
from enquiry enq
inner join edetails b
on enq.enqid = b.enqid this gets me the enqid associated with the rows but i want to display names from employee table using results on empid from above query. help me please.
Add another join with the employee table. If empid on the enquiry table allows nulls, make it a left join (assuming you’re mentioning the enquire table first) and just note that you might get nulls on the employee name column.
adrian thanks for the suggstion. im new to joins is it possible to write query by you.

Your query already has a join, it should not not be that difficult to add another one.[<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ />]
thanks that is correcte direction. i got that
Let us know what solution you find.[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]
quote:Originally posted by cb adrian thanks for the suggstion. im new to joins is it possible to write query by you.
Learn SQL http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Madhivanan Failing to plan is Planning to fail
I believe the originator is not a stated in SQL if you look at the initial query. [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />].<br /><br /><b>Satya SKJ</b><br />Microsoft SQL Server MVP<br />Writer, Contributing Editor & Moderator<br /<a target="_blank" href=http://www.SQL-Server-Performance.Com>http://www.SQL-Server-Performance.Com</a><br /><center><font color="teal"><font size="1">This posting is provided AS IS with no rights for the sake of <i>knowledge sharing. <hr noshade size="1">Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.</i></font id="size1"></font id="teal"></center>
thanks madhivan as satya referred i m not a learner in sql server.
]]>