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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:21:43+00:00 2026-05-23T00:21:43+00:00

I am not an expert on SQL, so I am asking here some help

  • 0

I am not an expert on SQL, so I am asking here some help about the following case :

I have 2 tables; 1 table “task” (ID,TITLE,CREATEDAT) and 1 table “activity” (ID,TASK_ID,TITLE,CREATEDAT) where CREATEDAT are a DATETIME column.

I would like to list the tasks ordering by last CREATEDAT column, in task and activity! I mean, have the most recent task (CREATEDAT AND which have the most recent activity, such an union of task & activity table…) but I have really no idea of how to process?

Thanks you for your help!

  • 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-23T00:21:44+00:00Added an answer on May 23, 2026 at 12:21 am

    To order tasks by most recent activity or creation date if there is no activity on the task:

    SELECT t.id, t.title 
      FROM task AS t
        LEFT JOIN activity AS a ON t.id=a.task_id
      GROUP BY t.id
      ORDER BY COALESCE(MAX(a.createdat), t.createdat) DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not an SQL expert, here is my SQLite query on table Query (key:
I'm not an expert with either System.Data nor SQL Server, but have a need
To anyone who can help. I am not an expert at T-SQL so I
To anyone who can help. I am not an expert at T-SQL so I
I'm not expert about css menus. But I know basic system to make css
I am not an expert web-dev so please bear with me here. I would
I'm trying to set up some exotic PHP code (I'm not an expert), and
I am not an expert on SQl Server. Is this a valid pattern for
I have a Person table with huge number of records(for about 16 million), and
I have a table like the following table: UserID Num1 Num2 Code Name Cat

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.