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

EXTRACT RECORD FROM MULTIPLE OCCURENCE OF SAME RECORD

Status
Not open for further replies.

Gemini07306

Technical User
Jun 25, 2003
15
US
Fellow tek-tippers,
I have a problem that I need help with. I have a table, and this table has multiple data that are the same. I need to extract only one occurence of the lot and display it on a form. The form part is not a big deal, but the code to extract the record from the table is. I need an SQL or a vb code (syntax) to accomplish this.
Example:
========

Name id salary
===== === ======
John 2 5.00
John 2 5.00
John 2 5.00
Pete 3 10.00
Pete 3 10.00
Angie 4 5.00
Ben 5 10.00

I would like to extract only one occurence of "John"
"" "" "" "Pete"
"" "" "" "Angie"
and "" "" "" "Ben".

And I need to display the output in a form(List)

Any help will be appreciated.
gemmini07306.



 
Code:
SELECT DISTINCT
       Name,
       id,
       salary
FROM aTable

But I wonder why you have duplicate rows. Isn't that a problem that needs to be addressed?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top