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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:57:52+00:00 2026-06-04T23:57:52+00:00

I want to retrieve latest records of two tables using UNION , it returns

  • 0

I want to retrieve latest records of two tables using UNION, it returns data, but not latest records, even with ORDER BY. It’s my query:

    SELECT TOP(1) OwnerID,NewsTitle,NewsCreationDate,NewsTitle,NewsEnglishName 
FROM TheaterNews 
    UNION
    SELECT TOP(3) OwnerID,NewsTitle,NewsCreationDate,NewsTitle,NewsEnglishName  
FROM MoviesNews
    ORDER BY 3 DESC

This is query’s output:
output using UNION

But the latest record of TheaterNews is newer:

SELECT  OwnerID,NewsTitle,NewsCreationDate,NewsTitle,NewsEnglishName 
FROM TheaterNews 
ORDER BY NewsCreationDate DESC

latest records for TheaterNews table

How can I fix this? even with another method.

  • 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-04T23:57:53+00:00Added an answer on June 4, 2026 at 11:57 pm

    This should work in your instance. Might be a rough solution but you will get your answers. you can replace the #tables with @tables.

    SELECT TOP(1) 
        OwnerID,
        NewsTitle,
        NewsCreationDate,
        NewsEnglishName 
    into
        #Table1
    FROM 
        TheaterNews 
    ORDER BY 3 DESC
    
    SELECT TOP(3) 
        OwnerID,
        NewsTitle,
        NewsCreationDate,
        NewsEnglishName
    into
        #Table2
    FROM 
        MoviesNews
    ORDER BY 3 DESC
    
    select * from #Table1
    union
    select * from #Table2
    
    drop table #Table1
    drop table #Table2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A user can have many addresses, but I want to retrieve the latest entry
I am using Postgresql, when I want to use PDO to retrieve the latest
I need to write a query to retrieve values from two columns using mysql
I am using the latest Facebook Toolkit. I want to retrieve all albums of
I am trying to do an SQL query on two tables to retrieve multiple
I want retrieve the width and height of browser in pixel(px) using ruby code.
I want to retrieve the last 3 registered users in cakephp using the field
I want to retrieve/query images stored by joomla k2 component (under the Image Tab).
I want to retrieve the latitude and the longitude of a data which is
I'm trying to create a SQL 2005 query to retrieve and combine records from

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.