PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

Using SQL Joins

By Angela Bradley, About.com

3 of 4

SQL Left Joins

Next try this code:

SELECT patients.name, meds.name, meds.dose FROM patients LEFT JOIN meds ON patients.med_id = meds.med_id

As you see, in this case using the LEFT JOIN gives us the same results that our WHERE did above. The difference is that even if there is no data in the second table, a result from the first table will be displayed and the second entry will be NULL.

Explore PHP / MySQL

About.com Special Features

PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Learn MySQL
  5. SQL Join - SQL Join Tutorial - SQL Left Join

©2009 About.com, a part of The New York Times Company.

All rights reserved.