October 24th, 2011, 09:28 AM
How to select all but only display certain columns of a table in sql
I need to run a query on a table that several of the columns but only display the first name last name and office number in a dropdown list. I need to retrieve the other columns because the additional fields will need to be posted to a new table based on the users selection from the dropdown box. I am having trouble with the query. This is what I have:
Select LastName + ' ' + FirstName + ' ' + 'office ' + ' ' + Company AS Agent, AssociateCell,Email
Where Inactive = '0' AND Role ='agent'
Order By LastName
I need for the last name, first name and office number to be displayed in the dropdown list as 'Agent' but once the user chooses one I need for the 'Agent' "AssociateCell and Email to post to a new table. Any assistance would be greatly appreciated.