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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:09:42+00:00 2026-05-28T06:09:42+00:00

I will try and ask my question clearly… I have three tables that each

  • 0

I will try and ask my question clearly…

I have three tables that each contain a date value. Node and Product have a “created on” date and Shared has a “timestamp” date. I need to figure out how to order by a single date… I need to merge both dates together…

it needs to fit in this statement

SELECT sc.auto_id AS autoid, sc.uid AS sharedby, n.nid, sc.message AS sharedmessage, 
    (
SELECT COUNT(1) 
FROM {share_content} AS sc2
  WHERE sc2.nid = sc.nid
) AS countnid 
FROM {node} n LEFT JOIN {content_type_product} p on n.nid = p.nid 
  LEFT JOIN {share_content} sc on sc.auto_id=
(
SELECT MAX(auto_id) FROM share_content sc1
WHERE sc1.nid = n.nid 
LIMIT 1
) 
WHERE (
    n.type = 'blog' 
    OR n.type = 'field_school' 
    OR n.type = 'photo_gallery' 
    OR n.type = 'forum' 
    OR n.type = 'product_review' 
    OR n.type = 'product' and p.field_front_page_value = 'Add to feed'
    OR n.type = 'reference'
    OR n.type = 'video_gallery'
    OR n.type = 'video'   
    OR n.type = 'groups' 
    OR n.type = 'group_post'  
    OR n.type = 'status' 
    OR (n.type = 'event' AND n.uid != '2')
    OR n.type = 'jobs_careers'
    OR n.type = 'post_link'
    OR (n.type = 'news_article' AND n.uid != '2' AND n.uid != '0'))  
AND n.status = '1' 
ORDER BY n.created DESC";

(order needs to be a merge between n.created, p.created and sc.date_shared)…

Thank you,

Matt

  • 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-28T06:09:43+00:00Added an answer on May 28, 2026 at 6:09 am

    Horrifying!!!

    ORDER BY 
    (CASE WHEN Table2.Id IS NULL AND Table3.Id IS NULL THEN Table1.Created_on
          WHEN Table2.Is IS NULL 
           THEN (CASE WHEN Table1.CreatedOn <= Table3.CreatedOn THEN Table1.CreatedOn 
                      ELSE Table3.CreatedOn END)
          WHEN Table3.Id IS NULL
           THEN (CASE WHEN Table1.CreatedOn <= Table2.timestamp THEN Table1.CreatedOn 
                      ELSE Table2.timestamp END)
          WHEN Table1.CreatedOn <= Table3.CreatedOn AND Table1.CreatedOn <= Table2.timestamp
           THEN Table1.CreatedOn
          WHEN Table3.CreatedOn <= Table1.CreatedOn AND Table3.CreatedOn <= Table2.timestamp
           THEN Table3.CreatedOn
          ELSE Table2.timestamp END)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It quite hard question to ask but I will try. I have my 4
hihi i have a question that i want to ask about c# and window
I have already created a login() . Trying to ask a random question each
I will try and illustrate my question with examples, I am attempting to create
I will try to keep this as simple as possible. I have a rather
I am working on an algorithm that will try to pick out, given an
I have a problem and I will try to explain the issue: I have
Let me explain the situation before I ask the question. I have a site,
I know Stackoverflow doesn't want discussions, so I will try to ask an answerable
I want to ask you a question.I am not sure I will get any

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.