Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Info from Another Table Problem 1

Status
Not open for further replies.

kathyc20

Programmer
Mar 7, 2001
96
CA
I have constructed the query below, but the OwningUser field displays a numeric value, and not the OwningUser's name. This info is located in a table called:

dbo.SystemUserBase and the field I need is the FirstName field from this table.

How do I construct this query so that I can get the OwningUser's FirstName from the dbo.SystemUserBase table and display that in my query?

Any help is appreciated.

-----------------------------

SELECT CFScompanyname, TicketNumber, CreatedOn, StatusCode, Title, OwningUser

FROM dbo.incidentbase WHERE
(
CFScompanyname like 'EMC%' or
CFScompanyname like 'BERE%' or
CFScompanyname like 'TRE%'
)

AND
(
StatusCode = 2 or
StatusCode = 7 or
StatusCode = 13 or
StatusCode = 9 or
StatusCode = 4 or
StatusCode = 1 or
StatusCode = 8 or
StatusCode = 3
)

ORDER BY CFScompanyname




 
Have a look at JOIN:
SELECT I.CFScompanyname, I.TicketNumber, I.CreatedOn, I.StatusCode, I.Title, I.OwningUser, U.FirstName
FROM dbo.incidentbase I
INNER JOIN dbo.SystemUserBase U ON I.OwningUser = U.UserIDcolumn
WHERE ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top