About
Pricing
Community
Teams
Start Free Trial
Log in
Ganesh Thandapani
asked on
3/25/2017
MySQL to get Limited value from each category.
I have user table which contains user_name, import_id, user_category
user_name import_id user_category
aaaaa 1 1
bbbbbb 1 1
aaaaa 1 1
bbbbbb 1 1
aaaaa 1 2
bbbbbb 1 2
aaaaa 1 2
bbbbbb 1 2
aaaaa 1 3
bbbbbb 1 3
aaaaa 1 3
bbbbbb 1 4
aaaaa 1 4
bbbbbb 1 5
in which i have to show only two values in each category as a result
SQL
MySQL Server
6
1
Last Comment
Sharath S
8/22/2022 - Mon
Patrick Bogers
3/25/2017
Hi
Can you be a little more specific about the output you expect?
Ganesh Thandapani
3/25/2017
ASKER
simply i have to show only two result for each category, not all the result
ASKER CERTIFIED SOLUTION
Sharath S
3/25/2017
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
arnold
3/25/2017
Is the output you want
aaaaa,1,1
aaaaa,1,2
As an example?
The distinct option example will eliminate duplicates which you have!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Ganesh Thandapani
3/25/2017
ASKER
ok nice, the distinct is used to avoid duplicates. Another condition if i want to take two or three values for each category how can i do that, any idea please.
Sharath S
4/4/2017
Post your expected result.
Can you be a little more specific about the output you expect?