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