MYSQL SELECT Query

Wednesday, November 4, 2015

I have two tables products and similar_products. Products tables holds data related to available products however this tables has loads of products that are same but with different product id. Which is why I have another table that hold the data for all the similar products. I need to run a query that selects products from products table but at the same also check in similar_products tables to not select any duplicate products.



So for example:



Products Table:



ProductID--------------- Manufacturer----------------Part No----------------------------Name



8202-----------------------Hp-----------------------------402146-B21----------------------HP Auto Synch Cable



8210-----------------------Hp-----------------------------113894-B21----------------------HP Stylus 3 Pack



8211-----------------------Hp-----------------------------113894-B21----------------------HP Stylus 3 Pack



8212-----------------------Hp-----------------------------113894-B21----------------------HP Stylus 3 Pack



Similar_products Table



ProductID----------------Similar_ProductID



8210-----------------------8211



8210-----------------------8212



8211-----------------------8210



8211-----------------------8212



8212-----------------------8210



8212------------------------8211



How can I run a query that will only select ProductID 8202 and 8210 and not select duplicates products.

0 comments:

Post a Comment