a standard join looks like this..

select foo from a
join b on a.id = b.id

So yours would look something like

SELECT PartNumber
FROM GriffinDataRevised d
JOIN Top200 t on d.partnumber = t.part_number

You're not technically doing a join, you're doing a sub query.

On Tue, Feb 1, 2011 at 11:41 AM, Aaron Renfroe <mossma...@gmail.com> wrote:
>
> Hello All!
>
> I'm trying my first Join of two tables and not having the best of luck...
>
> One table holds just a part number off our top 200 products, the second table 
> holds a part number along with all the information that accompanies that part.
>
> I'm trying to pull back all the data from the information table that has a 
> matching part number in my top 200 table.
>
> Here are a few ways i have tried :
>    SELECT DISTINCT PartNumber
>    FROM GriffinDataRevised
>    WHERE PartNumber IN (SELECT part_number FROM Top200)
>
> -- This one brings back 15k results with tons of duplicates
>
>
>
>    SELECT *
>    FROM GriffinDataRevised
>    WHERE PartNumber = (SELECT Part_Number FROM Top200 WHERE 
> Top200.part_number = 'GriffinDataRevised.PartNumber')
>
> -- This one, no results shown
>
>     SELECT DISTINCT PartNumber FROM GriffinDataRevised
>     INNER JOIN Top200 ON GriffinDataRevised.PartNumber = Top200.Part_Number
>     WHERE Top200.part_number = GriffinDataRevised.PartNumber
>
> -- This one returns 98 results when there should be 200. I'm still trying to 
> confirm if there are duplicate PN's in the list.
>
> Thank you,
> Aaron
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:341794
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to