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 3806200
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:47:52+00:00 2026-05-19T14:47:52+00:00

I have next sql select site_id,count from tags where match (tag) against (‘statistici’ in

  • 0

I have next sql

select site_id,count from tags where match (tag) against ('statistici' in boolean mode) ORDER BY count DESC;

+---------+-------+
| site_id | count |
+---------+-------+
|       9 |  1300 |
|      13 |  1200 |
|       9 |  1100 |
|      13 |  1000 |
|       9 |   900 |
|      13 |   800 |
|      13 |   800 |
+---------+-------+

What i need is to get distinct site_id.
But when i use a group by statement the order by count is not kept

select site_id,count from tags where match (tag) against ('statistici' in boolean mode) GROUP by site_id ORDER BY count DESC;

+---------+-------+
| site_id | count |
+---------+-------+
|      13 |  1000 |
|       9 |   900 |
+---------+-------+

What should i do ?

  • 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-19T14:47:52+00:00Added an answer on May 19, 2026 at 2:47 pm

    You’re ordering by ORDER BY count DESC, and the result is ordered with the highest count first.

    Change to ORDER BY count ACS if you prefer the lowest count first.

    EDIT: Based on your comment, perhaps this is more like what you’re trying to achieve:

    select  site_id
    ,       max(count) as TopCount
    from    tags 
    where   match (tag) against ('statistici' in boolean mode) 
    group by 
            site_id 
    order by
            TopCount DESC
    

    This selects the highest count per site, and places the highest count first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have next code getEntityManager().persist(country.getCity().getClinic().getPatient()); and see next sql in log Hibernate: select next
Let's say I have this sql query: SELECT * FROM questions ORDER BY votes
I have the SQL query: select title, scale / next_scale, c from ( select
I have the following SQL: SELECT id, url FROM link WHERE visited = false
I have the next query: var bPermisos = from b in ruc.Permisos where b.IdUsuario
I have next block in the end of each my stored procedure for SQL
The following query is in SQL: SELECT r.reservation_no, f.flight_no, r.departure_date, f.departure_time, f.duration FROM flights
Let's say I have the following SQL query SELECT id, name, title, description, time
I have next tables Order , Transaction , Payment . Class Order has some
I'm going to start of by noting that I have next to no python

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.