AvocadoSoftware.com

Software For Hardcore Developers
Welcome to AvocadoSoftware.com Sign in | Join | Help
in Search

Derick Baileys old blog archives - go to derickbailey.com for new contents

SQL Inner Outer or ??? Join: Return records NOT in join table?

I've had this question for a long time, but am just now getting around to seeing it in an app again.... Given the scenario of 3 tables to create a many to many relationship:

Table1
ID
Name

Table2
ID
Name

jTable3
Table1_ID
Table2_ID

How do you create a select statement, using a Join (not a sub select or sub query) to specify that you want to retrieve all of the records from Table1 that have NOT been assigned to a specific record from Table2? i.e. Table1 has 3 records in it, and Table2 has one record in it. jTable3 has 2 records that join the only record from Table2 to the first two records in Table1. I want a select statement that only uses Joins (no sub selects or sub queries allowed) to return all of the records from Table1 that are not assigned to the record in Table2. Keep in mind that this must work for any ammount of data and any ammount of records in Table1 and Table2, with an unkown number of associations made in jTable3.

 

Published Wednesday, June 16, 2004 7:45 PM by dredge
Filed Under: ,
New Comments to this post are disabled

This Blog

Post Calendar

<June 2004>
SuMoTuWeThFrSa
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

Advertisement

News

this is my old blog archives - go to http://derickbailey.com for updates

Syndication

Advertisement

Powered by Community Server, by Telligent Systems