JOIN in SQL with one-to-many relationship

Posted by Kristopher Ives on Stack Overflow See other posts from Stack Overflow or by Kristopher Ives
Published on 2010-03-18T18:40:56Z Indexed on 2010/03/18 18:51 UTC
Read the original article Hit count: 224

Filed under:

I'm making a tool to track calls to house/senate reps, and I have 2 tables of importance here:

reps

rep_id
rep_name # and more info

comments

rep_id
status # enum about result of contact
comment

I want to query for all reps joining the most recent associated comments and in some cases joining comments of a specific status, but there might not be any comments associated with that rep yet.

THANKS!

© Stack Overflow or respective owner

Related posts about sql