Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help Adding Column to Select Statement

Author  Topic 

hollyquinn
Starting Member

31 Posts

Posted - 2009-08-06 : 12:25:11
Can anyone help me with adding an additional column to this SQL Statement?

SELECT FullName FROM
(
SELECT
FullName = (LastName + ' ' + FirstName)
FROM UserProfile
) sub
WHERE sub.FullName = @un

I want to be able to select not only FullName from UserProfile, but also the column Email. My SQL skills are not that hot. Thanks in advance.

I'm really in a bind. I'm working on a web app that has to go live Saturday!!!

lynda
Starting Member

21 Posts

Posted - 2009-08-06 : 12:57:03
Does:

SELECT FullName, Email FROM
(
SELECT
LastName + ' ' + FirstName as FullName, Email
FROM UserProfile
) sub
WHERE sub.FullName = @un

Not work?
Go to Top of Page

hollyquinn
Starting Member

31 Posts

Posted - 2009-08-06 : 13:00:50
quote:
Originally posted by lynda

Does:

SELECT FullName, Email FROM
(
SELECT
LastName + ' ' + FirstName as FullName, Email
FROM UserProfile
) sub
WHERE sub.FullName = @un

Not work?



Thank you lynda! That works great.
Go to Top of Page
   

- Advertisement -