Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6196725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:41:39+00:00 2026-05-24T03:41:39+00:00

My problem is that in the result a user can be in it more

  • 0

My problem is that in the result a user can be in it more then one time if he is in more then 1 higher ranked group.

SELECT xf_user_group_relation.user_id , xf_user_identity.account_name, xf_user_group_relation.user_group_id, MAX( xf_user_group.display_style_priority ) AS display_style_priority
FROM xf_user_group_relation
INNER JOIN xf_user_group ON xf_user_group_relation.user_group_id = xf_user_group.user_group_id
INNER JOIN xf_user_identity ON xf_user_group_relation.user_id = xf_user_identity.user_id
WHERE xf_user_group.display_style_priority >=1000 AND identity_service_id = 'Minecraft'
GROUP BY xf_user_group_relation.user_id, xf_user_group_relation.user_group_id, xf_user_identity.account_name

Result:

|user_id|account_name|user_group_id|display_style_priority|
|1|yuriman|5|10000
|1|yuriman|6|9000
|2|skull905|5|10000
|13|ryan1271|5|10000
|21|mr_matt|9|6000
|37|Gaurav251|12|1000
|38|tvmaniac9|9|6000
|38|tvmaniac9|11|2000
|44|robyrq|9|6000
|44|robyrq|12|1000
|86|sabasNL|11|2000
|86|sabasNL|15|5200
|128|Scarykittens|9|6000
|133|Sargent5|10|5000
|133|Sargent5|11|2000
|142|kevy76|9|6000
|142|kevy76|11|2000
|144|liljew29|10|5000
|144|liljew29|11|2000
|149|a7xtdgfan332|10|5000
|160|TheNeoStrike|11|2000
|189|CptToddney|11|2000

The result should look like this:

|user_id|account_name|user_group_id|display_style_priority|
|1|yuriman|5|10000
|2|skull905|5|10000
|13|ryan1271|5|10000
|21|mr_matt|9|6000
|37|Gaurav251|12|1000
|38|tvmaniac9|9|6000
|44|robyrq|9|6000
|86|sabasNL|11|2000
|128|Scarykittens|9|6000
|133|Sargent5|10|5000
|142|kevy76|9|6000
|144|liljew29|10|5000
|149|a7xtdgfan332|10|5000
|160|TheNeoStrike|11|2000
|189|CptToddney|11|2000

I want the result to have the users highest ranked group only which is the one with the highest display_style_priority.
Im not sure how to fix that.

Best Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:41:41+00:00Added an answer on May 24, 2026 at 3:41 am

    i think you need to change the group by

    GROUP BY xf_user_group_relation.user_id, xf_user_identity.account_name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that seems like its a result of a deadlock-situation. Whe
One problem that I come across regularly and yet don't have a solution to
Simple problem that I can't figure out... How can I print a '%' character
I want to extend the asp.net validators such that I can make one validator
I have user-interface where user can select grid column (like age) and operator (lesser
I'm running into a problem that I can't seem to solve. The code works
I have simple LINQ problem that I can't figure out. I have a table
The problem is that search results overlap and make it hard to see whether
I'm working on a problem that requires caching paginated search results: Paginating very large
A problem that we need to solve regularly at my workplace is how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.