On 2/1/2011 9:41 AM, Aaron Renfroe wrote:
> Hello All!
>
>       SELECT DISTINCT PartNumber FROM GriffinDataRevised
>       INNER JOIN Top200 ON GriffinDataRevised.PartNumber = Top200.Part_Number
>       WHERE Top200.part_number = GriffinDataRevised.PartNumber

INNER JOIN will enforce a filter that will only return records in a 
given 'partnumber' is in BOTH tables.  The return of 98 recrods would 
indicate that there are only 98 values of 'partnumber' that are in both 
tables.

If that is expected and known behavior then what you want is an OUTER 
JOIN that says return all records from one table PLUS any records from 
the other table IF they match.

IE

FROM GriffinDataRevised
      LEFT OUTER JOIN Top200 ON GriffinDataRevised.PartNumber = 
Top200.Part_Number
This will return all the records from the table on the LEFT side of the JOIN 
'GriffinDataRevised'

OR

FROM GriffinDataRevised
      RIGHT OUTER JOIN Top200 ON GriffinDataRevised.PartNumber = 
Top200.Part_Number
This will return all the recrods from the table on the RIGHT side of the JOIN, 
'Top200'

Some database management systems support the FULL OUTER JOIN that will return 
unmatched records from BOTH sides of the join.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341793
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to