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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:03:33+00:00 2026-05-28T18:03:33+00:00

Hope this is possible- Have a table like so: Car_ID Brand Model Year ———————————-

  • 0

Hope this is possible-

Have a table like so:

Car_ID    Brand    Model      Year
----------------------------------
   1      Ford      Focus       2012
   1      Ford      Mustang     1992
   2      Toyota    Yaris       2005
   3      BMW       1s          1995
   4      VW        Polo        2010
   4      VW        Golf        2002
   4      VW        Beetle      2007

And want it ordering like this:

Car_ID    Brand    Model      Year
----------------------------------
   1      Ford      Focus       2012
   1      Ford      Mustang     1992

   4      VW        Polo        2010
   4      VW        Beetle      2007
   4      VW        Golf        2002

   2      Toyota    Yaris       2005

   3      BMW       1s          1995
  • So the brand with the newest model is first, followed by the rest of
    the brand’s models in order of newest.

  • Next is the brand with the second newest model and the rest of cars
    of that brand, newest first

  • And so on.

Any ideas if this can be done?

–ANSWER– – my answer was wrong, will post back when I test some more

  • 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-28T18:03:34+00:00Added an answer on May 28, 2026 at 6:03 pm
    mysql>     SELECT cars.*
        -> 
        ->       FROM cars
        ->       JOIN ( SELECT Name_ID, MAX(Year) AS max_year 
        ->              FROM cars 
        ->              GROUP BY Name_ID )
        ->         AS dt_max
        ->      USING (Name_ID)
        -> 
        ->   ORDER BY max_year DESC, Name_ID, Year DESC;
    +---------+--------+---------+------+
    | Name_ID | Brand  | Model   | Year |
    +---------+--------+---------+------+
    |       1 | Ford   | Focus   | 2012 |
    |       1 | Ford   | Mustang | 1992 |
    |       4 | VW     | Polo    | 2010 |
    |       4 | VW     | Beetle  | 2007 |
    |       4 | VW     | Golf    | 2002 |
    |       2 | Toyota | Yaris   | 2005 |
    |       3 | BMW    | 1s      | 1995 |
    +---------+--------+---------+------+
    7 rows in set (0.00 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple database structure like this: entries table +----+-----------+------------+-----------+------+ | id |
I have a table (in MySQL) that stores votes. The structure is like this:
Hope this is not a dupe. I would like to be able to do
I hope I can explain this clearly: I have two tables with the following
I have a question about Excel! I hope that isn't too unconventional for this
I have a query like this: SELECT A, B, C, CASE WHEN 1 =
I have one table view within the app that I hope multiple parts of
for example we have a table with the columns id, name, type, year. My
I have a database table that stores imported information. For simplicity, its something like:
Alright, I'm going to try to explain this as best as possible: I have

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.