If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > SQL Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-12, 13:26
ericx1 ericx1 is offline
Registered User
 
Join Date: Oct 2011
Posts: 71
SQL Help

I have two tables tbl_Notification and tbl_EventNotification, joined together

tbl_Notification is a list table and tbl_EventNotification is a junction table between the list and main table.

tbl_Notification
NotificationID

tbl_EventNotification
EventID
NotificationID

Say I have 5 entries in tbl_Notification.

Home
Business
Cell
Fax
Email

And I have 2 entries for a specific EventID in tbl_Notification

Home "No Answer"
Cell "Bob"

What I want displayed is

Home "No Answer"
Business
Cell "Bob"
Fax
Email

Everything I have attempted to do has either only given me the two enteries or gives me entries from other EventID.

Can anyone help me with how to get this desired outcome with a SQL statement?

Thanks for your time, thoughts and knowledge!
Reply With Quote
  #2 (permalink)  
Old 01-17-12, 14:33
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
use a LEFT OUTER JOIN
Code:
SELECT tbl_EventNotification.EventID
     , tbl_Notification.NotificationID
  FROM tbl_Notification
LEFT OUTER
  JOIN tbl_EventNotification
    ON tbl_EventNotification.NotificationID = tbl_Notification.NotificationID
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-17-12, 15:15
ericx1 ericx1 is offline
Registered User
 
Join Date: Oct 2011
Posts: 71
Thanks for the reply works perfectly. Genius me forgot the "ON" portion of the sql syntax, I'm feeling smart today

Thanks for the time to answer a silly question!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On