A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
to get the most repeated column name
Joined: Nov 04, 2007
Feb 19, 2008 05:05:00
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.
Joined: May 26, 2003
Feb 19, 2008 16:23:00
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.
select product, count(*) as "num" from products order by num desc
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
subject: to get the most repeated column name
Checking a string
displaying the most highly repeated entry in an ArrayList
Am I ready?
SQL for the top 2 most recurring values in a column
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014