Advanced SQL

  • From: Jeff Berwick <mailinglists@xxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Thu, 25 Aug 2011 19:10:06 -0400

Hi Listers,

I need some sql assistance.  

I have three tables that are connected in a many to many relationship.  The 
three tables are:

topic, relationship (the many to many table) and Action.

I want to show all the relationships but, if there are no relationships I need 
to still show the Topics.  Sample tables might look like:

Topic
 ++++++
id
+++++
1
2
3
4

Relationship
+++++++
topic_id | action_id
+++++++
1 | 1
3 | 2
4 | 3
4 | 4

Action
++++++
id
+++++
1
2
3
4

I know I need to use a left outer join at some point but, can't get this 
figured out.  Any assistance is welcome and appreciated.

TIA,
Jeff

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: