Question : Combine first and last name from one table into another SQL statement

I have two SQL statements:

Select firstname, lastname from Users where userid = 5

I need to somehow have that statement put into the following

SELECT Item, (the select statement above) AS AssignedUser, ItemNumber FROM Items WHERE ItemId = 5

How can I put the two fields from the user table into the select statement directly above and call the field 'AssignedUser'?  Thanks!

Jon

Answer : Combine first and last name from one table into another SQL statement

In SQL Server you can do this:
SELECT Item, (Select firstname + ' ' +  lastname from Users where userid = 5) AS AssignedUser, ItemNumber FROM Items WHERE ItemId = 5

if you want firstname and lastname as 2 fields:
SELECT i.Item, u.firstname , u.lastname ,i.ItemNumber
FROM Items i, Users u
WHERE i.ItemId = 5
and u.userid = 5
Random Solutions  
 
programming4us programming4us