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

Need: Query to show double records 1

Status
Not open for further replies.

Nage

Programmer
Jul 10, 2000
10
NL
Hello,

Does anybody know the query-sting to show all records which have a double product number?

ex.
(product) (prod. number)
Prod 1 AB11
Prod 2 AB12
Prod 3 AB13
Prod 4 AB12
Prod 5 AB13

The query has to show:
Prod 2
Prod 4
Prod 3
Prod 5

Can't find it in the manual!

Please help!

Nage
 

Write a query that counts the entries per product. Select records from the result that have count=2. Use COUNT function, GROUP BY and HAVING clauses.

Select Product From Table
Where ProdNo In
(Select ProdNo From table
Group By ProdNo Having Count(*)=2)

Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top