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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How canI list one value in a query? 1

Status
Not open for further replies.

mlrmlr

Technical User
Mar 17, 2006
168
US
Hello,

How can I list one user name instead of multiple?

Example:
I have the following filter used to locate an update record. The filter query is attached to a combo box and list the names of users. Currently the names are listed as follows:

June
June
June

I would like to list only one "June". Here is the query.

<BEGIN QUERY>
SELECT tech_table.t_id, [tech_firstname]+" "+
[tech_lastname] AS Name, tech_table.current_status
FROM tech_table
WHERE (((tech_table.current_status)="Active"))
ORDER BY [tech_firstname]+" "+[tech_lastname];
<END QUERY>

Thank you so much for your assistance.
 
Hi!

You need to add the word Distinct after the word Select.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
It would appear that there are three rows in the table with first name of June and no last name. There will be three different t_id values if that is true.

So listing only one June is not really the issue. Showing additional information that identifies the three Junes might be the answer. Or controlling the data added to the table so that June Smith is only added one time and that her last name is also required might be the answer.

Does that help?
 
Regarding the suggestion by jebry. DISTINCT would yield a single row for June provided that each June has the same t_id.

If that is true then you have another problem. The problem is duplicated rows. That is a 'bad thing'. The t_id should be unique.

 
Sorry, I should have presented a better example.

I am pulling the first and last name of the user. The problem was that the name June Smith was listed multiple times in the combo box and all I wanted was one June Smith listed.

The "Distinct" worked great!!

Thank you two so much for your response and assistance.
:-D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top