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

  • SEARCH
  • Home
  • 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 7973499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:07:21+00:00 2026-06-04T08:07:21+00:00

I need to order my query by date first… So I used this: SELECT

  • 0

I need to order my query by date first…

So I used this:

SELECT * FROM `mfw_navnode` order by `id` DESC

I wanted to order my results from last to first.

Then what I am trying to do

is to add a query over it, which would group my results by node_name..

The result should be..all the top nodes grouped by “category/node name type”, while the first node that I see is was ordered the highest for its category in the first query..

I thought to do something like this:

SELECT * FROM( 
SELECT * FROM `mfw_navnode` order by `id` DESC) AS DD
WHERE (node_name='Eby' OR node_name='Laa'  OR node_name='MIF' OR node_name='Amaur' OR node_name='Asn' )
GROUP BY DD.node_name

I get no result..or any response from phpmyadmin when I input that result..

Where do I get wrong?

Note , I dont want to group my results and then order them..

I want them to be ordered, and then grouped. After being grouped..I want the result of each group to have the highest value ..from the other rows in the group

  • 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-06-04T08:07:22+00:00Added an answer on June 4, 2026 at 8:07 am

    It is not sufficient to perform the ordering first, as even then MySQL makes no guarantee over which record it will select for each group. From the manual:

    The server is free to choose any value from each group, so unless they are the same, the values chosen are indeterminate.

    You must instead identify the records of interest with a subquery, then join the result with your table again in order to obtain the related values:

    SELECT *
    FROM   mfw_navnode NATURAL JOIN (
             SELECT node_name, MAX(id) AS id FROM mfw_navnode GROUP BY node_name
           ) AS DD
    WHERE  node_name IN ('Eby', 'Laa', 'MIF', 'Amaur', 'Asn')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to used dynamic order query in mysql and i have successfully achieved
I have this query: SELECT s.last_spread, s.sd, s.mean, s.id ,c.id_ticker, c.coef ,t.ticker ,/*p.last,*/ p.price
This first query grabs all the transaction_details for a particular date range This is
I have two queries. The first query: select in_gentime from in_time_temp where cardnumber =
my first query SELECT ID FROM wp_posts WHERE post_type = 'post' AND post_status =
The below shown is my query I need to order by with these three
I need to order the articles stored in a database by descending publication date
I need the results to show the most recent first - at the moment
The first select is select user_id, count(*) as count from users where referrer IS
i want something like this: SELECT DISTINCT ID from copies WHERE timestamp < 1229444506

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.