Jump to content

MYSQL complex query to get data group by name with unique value for each set of five


TheGuru

Recommended Posts

I have a table in MYSQL as follows

 

Id-------NAME

1-------Black

2-------Red--

3-------Green

4-------Black

5-------Green

6-------Yellow

7-------Orang

8-------White

9-------Black

10-------violet

11-------maroA

12-------indiA

13-------Blue

14-------Yellow

15-------Orane

16-------White

17-------White

18-------White

 

 

I need to get the id of each color names where the condition matches unique names for each set of five rows and if any duplicate occurs then it has to be moved to end of the result.

Note: I don’t want the count (max/min) as a result for each color names

 

output:

 

ID: 1 8 6

NAME: Black | white | yellow | violet | orange | - Black | white | yellow | violet | orange | - Blue| maroon | white| white | white |

 

Kindly guide if this is possible to get MYSQL query

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.