Today, I found a need to show all rows in a table and add associated information from another table. After reading a SQL reference manual on LEFT JOIN, I gave it a try and it met my needs. Here is the general format: SELECT field1, field2 FROM table1 LEFT JOIN table2 ON condition1 WHERE condition2 According to the documentation, the ON condition tells the database how to join the tables while the WHERE condition tells the database to return what row(s) as part of result set.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s