• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

sql select statement that only displays some of the colums

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

Hello,
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
From tbl1
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. The query does not appear to be pulling the last two columns and I cannot figure out what I am  doing wrong. Any assistance would be greatly appreciated.
0
jdines
Asked:
jdines
  • 2
1 Solution
 
sdstuberCommented:
the syntax is correct - that query will return 3 columns  Agent,  AssociateCell,  Email.

if you run that query in studio  it doesn't do that?

if it does, then the problem must be something in your app code that binds the query to the list
0
 
jdinesAuthor Commented:
Yes it runs correctly in studio, I think the problem is that once I retreive the AssociateCell and Email I don't have it posted anywhere on the form so a hidden input field is required, am I on the right track?  
0
 
sdstuberCommented:
probably, it'll depend entirely on the application language/framework used.

if you need to pursue that, then I suggest opening a new question in whatever zones are appropriate to your gui environment
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now