You are here: Re: Beginner question, stored procedure « MsSQL Server « IT news, forums, messages
Re: Beginner question, stored procedure

Posted by Plamen Ratchev on 11/18/07 04:16

Hi Richard,

You simply add one more join for the Employees table to get the names for
the other ID, something like this:

SELECT A.EmployeeID,
E.FirstName AS emp_fname,
E.LastName AS emp_lname,
A.CreatedByID,
C.FirstName AS creator_fname,
C.LastName AS creator_lname,
A.Date1,
A.Date2,
A.Content
FROM EmployeeApplication AS A
JOIN Employees AS E
ON A.EmployeeID = E.EmployeeID
JOIN Employees AS C
ON A.CreatedByID = C.EmployeeID

This is assuming the CreatedByID column is referring to the EmployeeID
column from the Employees table. If that is not the case then you have to
replace the Employees table in the second join with the appropriate table
and the appropriate column for the join.

HTH,

Plamen Ratchev
http://www.SQLStudio.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация