mysql query

Problems with the Windows version of XAMPP, questions, comments, and anything related.

mysql query

Postby waseemasghar9 » 18. April 2020 19:41

Dear Sir,

I have two table in mysql database which as under...


Table A

+-----------+-----------+------------------+
| ID | Value | other |
+-----------+-----------+------------------+
| 123456 | 5 | 12 |
| 987654 | 7 | 15 |
| 456789 | 6 | 22 |
+-----------+-----------+------------------+


Table B
+-----------+-----------+------------------+
| ID | Type | other |
+-----------+-----------+------------------+
| 123456 | 00 | 2 |
| 123456 | 01 | 6 |
| 123456 | 02 | 4 |
| 987654 | 00 | 7 |
| 987654 | 01 | 8 |
| 456789 | 00 | 6 |
| 456789 | 01 | 16 |
+-----------+-----------+------------------+



Resultant Table C (After joint A and B table)
-----------+-----------+---------+------------------+
| ID | Type | Value | other |
+-----------+-----------+---------+------------------+
| 123456 | 00 | 5 | 2 |
| 123456 | 01 | 5 | 6 |
| 123456 | 02 | 5 | 4 |
| 987654 | 00 | 7 | 7 |
| 987654 | 01 | 7 | 8 |
| 456789 | 00 | 6 | 6 |
| 456789 | 01 | 6 | 16 |
+-----------+-----------+---------+------------------+



But i need this type of resultant table after joining two tables in mysql or sql lite database which are as under
Desired Resultant table C (after joining A and B table)
+-----------+-----------+---------+------------------+
| ID | Type | Value | other |
+-----------+-----------+---------+------------------+
| 123456 | 00 | 5 | 2 |
| ---------| 01 | - | 6 |
| ---------| 02 | - | 4 |
| 987654 | 00 | 7 | 7 |
| ---------| 01 | - | 8 |
| 456789 | 00 | 6 | 6 |
| --------- | 01 | - | 16 |
+-----------+-----------+---------+------------------+


If someone help me out i shall be really thank full.

Thank

Waseem
waseemasghar9
 
Posts: 1
Joined: 18. April 2020 19:10
XAMPP version: 3.2
Operating System: windows 10

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 275 guests