Question:
what is left join table SQL?
rawand o
2009-07-13 17:55:29 UTC
left join table MySQL
Four answers:
2009-07-13 19:20:31 UTC
A left join sql statement returns all the statements from the left table for every matching row in the right table and then those rows with no matching entries on the right table.



sounds gibberish, follow this example,



The "Persons" table:



P_Id LastName FirstName Address City

1 Hansen Ola Timoteivn 10 Sandnes

2 Svendson Tove Borgvn 23 Sandnes

3 Pettersen Kari Storgt 20 Stavanger



The "Orders" table:



O_Id OrderNo P_Id

1 77895 3

2 44678 3

3 22456 1

4 24562 1

5 34764 15



We use the following SELECT statement:



SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo

FROM Persons

LEFT JOIN Orders

ON Persons.P_Id=Orders.P_Id

ORDER BY Persons.LastName



The result-set will look like this:



LastName FirstName OrderNo

Hansen Ola 22456

Hansen Ola 24562

Pettersen Kari 77895

Pettersen Kari 44678

Svendson Tove
2009-07-13 18:49:38 UTC
a left join in SQL joins 2 tables.



http://www.w3schools.com/sql/sql_join_left.asp
Serge M
2009-07-14 11:51:07 UTC
All types of joins:

http://www.sql-tutorial.ru/en/book_using_multiple_tables_in_query.html
2009-07-13 18:11:57 UTC
try this quick tutorial:



http://www.tizag.com/mysqlTutorial/mysqlleftjoin.php


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...