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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:14:24+00:00 2026-06-10T06:14:24+00:00

I have a database with three tables: Table 1 CREATE TABLE A ( id

  • 0

I have a database with three tables:

Table 1

CREATE TABLE "A" ( "id" INTEGER PRIMARY KEY  NOT NULL 
                  ,"cat_id" INTEGER NOT NULL
                  ,"date" DATETIME NOT NULL
                  ,"amount" VARCHAR NOT NULL  DEFAULT (0.0)
                  ,"notes" VARCHAR)

Table 2:

CREATE TABLE "B" ( "id" INTEGER PRIMARY KEY  NOT NULL
                  ,"cat_id" INTEGER NOT NULL
                  ,"date" DATETIME NOT NULL
                  ,"amount" VARCHAR NOT NULL  DEFAULT (0.0)
                  ,"notes" VARCHAR)

Table 3:

CREATE TABLE "c" ( "id" INTEGER PRIMARY KEY  NOT NULL
                  ,"parent_id" INTEGER NOT NULL  DEFAULT (0)
                  ,"name" VARCHAR NOT NULL
                  ,"position" INTEGER NOT NULL
                  ,"importance" INTEGER NOT NULL  DEFAULT (0)
                  ,"transaction_type" VARCHAR NOT NULL  DEFAULT expenses
                  ,"icon" VARCHAR NOT NULL  DEFAULT default
                  ,"budget" INTEGER NOT NULL  DEFAULT 0
                  ,"status" INTEGER NOT NULL  DEFAULT 1)

I use this statement to select from the tables A and B:

SELECT * FROM A
UNION ALL
SELECT * FROM B 
ORDER BY date 

I want to join the result of this select statement with the third table C with:

RIGHT JOIN C on A.cat_id = C.id
RIGHT JOIN C on B.cat_id = C.id

How can i do this?!

  • 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-10T06:14:25+00:00Added an answer on June 10, 2026 at 6:14 am

    You can do it just by combining the elements of the SQL language:

    select ab.*, c.*
    from ((SELECT *
           FROM A
          ) UNION ALL
          (SELECT *
           FROM B
          )
         ) ab right join
         C
         on ab.cat_id = c.id
    ORDER BY date
    

    This makes the union all a subquery and then does the join from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three mysql table from same database Db1. Three tables have following columns.
In an SQL Server 2008 database, I have tables such as: CREATE TABLE t_DeviceType
I have a database with three tables: user_table country_table city_table I want to write
I have a database with three tables in my database namely catering, room, room_booking
I have three database tables: users emails invitations Emails are linked to users by
In my database I have three tables: Users: UserID (Auto Numbering), UserName, UserPassword and
I have three tables in a Mysql database - countries, cities and hotels. Their
I have an issue in entity framework code first, three table in database as
I have three or four tables in a MySQL database associated with an upcoming
I have created an sqlite table using the following statement: CREATE TABLE IF NOT

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.