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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.