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 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

This is related to this question . I'm not an expert on Linux device
I not a DB expert, so am looking for advice for a web-based system
$(document).ready(function() { $(span.link).mouseover(function(e){ $(this.children).css(display,inline); }); }); I'm not a javascript expert, but I've cobbled
I'm not considering this - I'm comfortable with C# and VB, but an expert
I have exceptions created for every condition that my application does not expect. UserNameNotValidException
Not very technical, but... I have to implement a bad words filter in a
(Not related to versioning the database schema) Applications that interfaces with databases often have
I'm working with an old sql server 2000 database, mixing some of it's information
I have been researching a way to get the SQL statements that are built
I have spent several hours with this SQL problem, which I thought would be

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.