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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:48:38+00:00 2026-06-11T07:48:38+00:00

I using MySQL, I have 2 Query Select SQL, first Query will return Result

  • 0

I using MySQL, I have 2 Query Select SQL, first Query will return Result A, and second will return Result B, so i want to combine that two Query Result, ID column of Result A and value_num of Result B become standard Column, and i don’t think for use subselect because i have tried that and it will take long time effort in query process , how can i do this ?

Result A :

+------------+--------------+
+  ID        +  Name        +
+------------+--------------+
+   1        +  Steve       +
+   2        +  Mile        +
+   3        +  Santo       +
+   4        +  Del Piero   +
+   5        +  Jack        +
============================+

Result B :

+------------+--------------+
+  Valuenum  +  value       +
+------------+--------------+
+   1        +      20      +
+   2        +      30      +
+   6        +      44      +
+   7        +      55      +
============================+

Combine Result A dan Result B, below is my expect output.

+------------+--------------+----------+
+ID_valuenum +  Name        + value    +
+------------+--------------+----------+
+   1        +  Steve       + 20       +
+   2        +  Mile        + 30       +
+   3        +  Santo       + Null     +
+   4        +  Del Piero   + Null     +
+   5        +  Jack        + Null     +
+   6        +  Null        + 44       +
+   7        +  Null        + 55       +
============================+==========+

Thanks

  • 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-11T07:48:40+00:00Added an answer on June 11, 2026 at 7:48 am
    select
      ta.Id as ID_Valuenume
      ,ta.name
      ,tb.value
    from TableA ta
    left join TableB tb on ta.ID=tb.valuenum
    union
    select
      tb.valuenum
      ,ta.name
      ,tb.value
    from TableB tb
    left join TableA ta on ta.ID=tb.valuenum
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to perform a SQL query that acts in two parts. First,
I am using a native sql query where I have a players table to
I am using the FULLTEXT in my sql query to search the records. SELECT
Possible Duplicate: SQL Query with MySQL I implement a Rest Web Service (JAX-RS) using
I have a datareader that binds a sql select (with 10 columns from table1)
Say I have a query select * from clauses where id in (0,2,5,1,3) and
everybody using mysql knows: SELECT SQL_CALC_FOUND_ROWS ..... FROM table WHERE ... LIMIT 5, 10;
I am running a query on a MySQL database, I am using JDBC and
Consider the SQL query below: SELECT * FROM opening_hours WHERE week_day = WEEKDAY(NOW()) +
I want to implement following logic in my SQL query: If some date is

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.