display all rows of a table after a join

227
August 11, 2017, at 00:27 AM

I want to display all the rows of Table A after joining elements from matching column from Table B

Table A

+-----------+----------+------------+
| FirstName | LastName |    Date    |
+-----------+----------+------------+
| Tia       | Carrera  | 1975-09-18 |
| Nikki     | Taylor   | 1972-03-04 |
| Yamila    | Diaz     | 1970-03-05 |
+-----------+----------+------------+

Table B

+-----------+------------+
|    code   | Date       |
+-----------+------------+
| 1234      | 1975-09-18 |
| 56789     | 1972-03-04 |
| 54856     | 1968-07-14 |
+-----------+------------+

everything I found online looks like

+-----------+----------+------------+-----------+
| FirstName | LastName |    Date    |    code   |
+-----------+----------+------------+-----------+
| Tia       | Carrera  | 1975-09-18 | 1234      |
| Nikki     | Taylor   | 1972-03-04 | 56789     |
+-----------+----------+------------+-----------+

but this is the result that I want

+-----------+----------+------------+-----------+
| FirstName | LastName |    Date    |    code   |
+-----------+----------+------------+-----------+
| Tia       | Carrera  | 1975-09-18 | 1234      |
| Nikki     | Taylor   | 1972-03-04 | 56789     |
| Yamila    | Diaz     | 1970-03-05 |           |
+-----------+----------+------------+-----------+
Answer 1

You want a left join:

select a.*, b.code
from a left join
     b
     on a.date = b.date;
Rent Charter Buses Company
READ ALSO
use css for resize image into mobile thumbnail

use css for resize image into mobile thumbnail

i use a wordpress plugin (Gmedia galleries) to create galleries, i have problem when i set Thumbnail Width Mobile and Thumbnail Height Mobile to 50 because the image is not centered into the Thumbnail

255
NodeJS truncating output only in server not in local

NodeJS truncating output only in server not in local

when the output size is ~ 400KB but node JS is truncating it I can invoke the api on the server, in my local it is notto answer why I think it is truncating is 1

290
Python and Node js communication

Python and Node js communication

I have been trying to communicate between Node JS and Python following this tutorial: http://wwwsohamkamani

403
Series object has no split attribute - reading in data from text file

Series object has no split attribute - reading in data from text file

I am reading in data from atxt file that looks like the following, and I am extracting the third item in each of the brackets with the code that is at the bottom

1732