File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes to get the most repeated column name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "to get the most repeated column name" Watch "to get the most repeated column name" New topic

to get the most repeated column name

pavani potnuru

Joined: Nov 04, 2007
Posts: 11
I have lot of products ordered by the user.Some of them are repeated.
How to get the most 5 frequently ordered products from the column named Product.
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30138

This query gives you the number of each distinct products. You want to add a clause to get the first 5 rows. This part varies by database.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: to get the most repeated column name
Similar Threads
Checking a string
SQL for the top 2 most recurring values in a column
Am I ready?
basic error
displaying the most highly repeated entry in an ArrayList