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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:56:38+00:00 2026-06-17T08:56:38+00:00

I have following tables structure.Need to select record from all tables those are recently

  • 0

I have following tables structure.Need to select record from all tables those are recently added by added_date.

I am trying to fetch titlename, sourcename, description, addde_date from table1, table2, table3 those are recently added by added_date.

Title name and source name are store in Title and source table.

I have try union on these table but Table3 content the different columns.

table1

    id   titleid   sourceid     text_content        added_date   -------
    1      15         20         XYzgff       10-10-2012:5:30pm
    2      10         5         gghghggg      10-11-2012:5:30pm

table2

    id   titleid   sourceid    description     added_date   -------
    1       6         8         fhjjjjjkk     11-04-2012:5:30pm 
    2      10         5         gghghggg      10-11-2012:5:30pm

table3

    id       url         Title     Description       added_date       -------------
    1       ggggg        fhhh        llllll         31-04-2012:5:30pm
    2       kkkkkk       ttttt       kkkkkk         10-11-2012:5:30pm  

Title table:

    titleid      title_name
      5            lgsfsgsf
      6            lkklgyy
      10           tyyiugj
      15          lklklklkl

Source table:

    sourceid      source_name
       5            jlkjljlj
       8            ghhhhhhh
       20           hhhhhhhf
       6            llllllll
  • 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-17T08:56:38+00:00Added an answer on June 17, 2026 at 8:56 am

    You should use UNION. Try this (untested):

    SELECT t.title_name, s.source_name, t1.text_content, t1.added_date   
    FROM Table1 t1
    JOIN Title T 
       ON t1.TitleId = T.TitleId
    JOIN Source S 
       ON t1.SourceId = S.SourceId
    UNION
    SELECT t.title_name, s.source_name, t2.description, t2.added_date   
    FROM Table2 t2
    JOIN Title T 
       ON t2.TitleId = T.TitleId
    JOIN Source S 
       ON t2.SourceId = S.SourceId
    UNION
    SELECT t.title_name, s.source_name, t3.description, t3.added_date   
    FROM Table3 t3
    JOIN Title T 
       ON t3.TitleId = T.TitleId
    JOIN Source S 
       ON t3.SourceId = S.SourceId
    

    Well I just realized you don’t have a SourceId or TitleId in your Table3. Not going to be able to get that information, but you could still do:

    SELECT DISTINCT Title_Name, Source_Name, Text_Content, Added_Date
    FROM 
    (
       SELECT t.title_name, s.source_name, t1.text_content, t1.added_date   
       FROM Table1 t1
       JOIN Title T 
         ON t1.TitleId = T.TitleId
       JOIN Source S 
         ON t1.SourceId = S.SourceId
       UNION
       SELECT t.title_name, s.source_name, t2.description, t2.added_date   
       FROM Table2 t2
       JOIN Title T 
         ON t2.TitleId = T.TitleId
       JOIN Source S 
         ON t2.SourceId = S.SourceId
       UNION
       SELECT t3.title, 'Unknown', t3.description, t3.added_date   
       FROM Table3 t3
    ) t
    ORDER BY added_date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables with the following structure : userid, entrydatetime, record. tableA -
I need help building a mysql query to select from multiple tables. I have
We have the following structure: ReportsDatabase X Report Y Report Y uses several tables
I have 2 tables Test1 and Test1Update with following structure Test1 id name address
I have two database tables with the following structure: actions: action_id int(11) primary key
I have the following table structure ZoneID int ZoneName varchar(50) I need to get
I'm using mysql/php/apache . I have the following situation: 2 tables where I need
I have a oracle table with record count of 99896618. I need to fetch
I have two tables that have the following structure: Table 1 : Show the
I have three tables, with the following structure: http://dl.dropbox.com/u/2586403/ORMIssues/TableLayout.png The three objects I'm dealing

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.