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

Using SQL Joins

By Angela Bradley, About.com

4 of 4

Right Joins

Finally try this code:

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

As you can see this makes the information on the Right side (in this case its the "dose" from our second table) the priority so results are displayed even when there is no patient.

By using each of these types of joining you can easily create dynamic reports from your data.

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

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

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

All rights reserved.