oracle765 Posted April 11, 2014 Share Posted April 11, 2014 MY QUERY SELECT gpb.shop_id,gpb.brand,gpb.image,gpb.model,gpb.link_url,gpb.offer_name,gpr.name,gpr.url,gpr.products,gpr.list FROM `getpriceproducts` gpb, `getpriceretailer` gpr WHERE `offer_name` LIKE '%washing%machine%' OR `model` LIKE '%washing%machine%' and shop_id = id http://www.getprice.com.au/buy-best-washing-machine.htm I have access to a feed and have loaded this into the database. I am basically trying to query the two tables getpriceproducts and getpriceretailer to obtain the same results as they do. trouble is its returning half a million rows, I cannot figure out how they are grouping the tables together to show say 8 prices for the same product. here is the query I have so far testing against the keyword "washing machine" and an example of the getprice results for the same keyword Quote Link to comment Share on other sites More sharing options...
Barand Posted April 11, 2014 Share Posted April 11, 2014 You need to specify the join condition between getpriceproducts and getpriceretailer tables, which is probably the retailerid. If you don't you join every record in one table with every record in the the other, hence the huge output It is also more efficient to use an explicit JOIN statement. instead of "..FROM A, B.." use ... FROM A INNER JOIN B ON A.x = B.y Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.