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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:15:20+00:00 2026-06-13T12:15:20+00:00

Lets say I have a table – tasks – with the following data: task

  • 0

Lets say I have a table – tasks – with the following data:

task    user     when_added
---------------------------
run     1        2012-08-09
walk    2        2012-08-07
bike    2        2012-08-07
car     1        2012-08-06
run     2        2012-08-06
car     1        2012-08-05
bike    1        2012-08-04
run     1        2012-08-04

As you can see the task is repetitive.

Question is, when i show the data e.g.

select * from tasks group by task order by when_added desc

How does the group by affecting the results? Does ‘group by’ group them in any order, can I make it?

The reason i ask is that I have a large table which i show data as above and if I lose the group by and just show results in date order, I get some results which do not show on group by, which means the task has been done before but it seems to be grouping by the oldest date and i want the newest date at the top of the pile.

Hope this makes sense…is it possible to affect the group by order?

  • 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-13T12:15:21+00:00Added an answer on June 13, 2026 at 12:15 pm

    Is that what you want?

    select task, group_concat(user), max(when_added)
    from tasks 
    group by task
    order by when_added desc
    

    group by is an aggregate function. In MySQL you can select not aggregates columns anyway, but you should not do that.

    If you group by a column then the results will be distinct for that column and all other data will be grouped around it. So there might be multiple data where task is run for instance. Just selecting other columns will select a random result. You should pick a specific result from that group like max or min or sum or concatenate them.

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

Sidebar

Related Questions

Lets say we have a table here, populated with the following data: acc_id1 acc_id2
Lets say i have a table with the following data Customer table: Name amount
Lets say I have a table with some data like the following: ID text
Lets say I have table with following columns 1. Client - string. 2. Profit
lets say i have this table user|group|acceptance 1 | a | -1 2 |
Lets say i have a table with the following definition create table dummy (col1
Lets say I have a table with the following rows/values: +--------+----------+ | ID |
so lets say i have a table called data data id | date |
lets say I have a table named myPlayerInfo with following rows 'player name' 'number
Lets say i have a table that has the following field names 'id' 'likes'

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.