rseigel Posted August 4, 2013 Share Posted August 4, 2013 I'm trying to run the following SELECT to get the data I need from my database. SELECT product.reference AS sku, product.price - specific_price.reduction AS price, stock_available.quantity, product.ean13 AS 'product-id', 'ASIN' AS 'product-id-type', product.condition FROM product, specific_price, stock_available WHERE product.id_product = specific_price.id_product = stock_available.id_product; PRoblem is that it takes too long to execute. I'm sure it's because I'm pulling from 3 different tables. Does anyone have a way to optimize this so it will work. I know all the field names are correct and everything worked until IO added that third table. Thanks, Link to comment https://forums.phpfreaks.com/topic/280824-select-help/ Share on other sites More sharing options...
rseigel Posted August 4, 2013 Author Share Posted August 4, 2013 Answered my own question. It's as simple as: SELECT product.reference AS sku, product.price - specific_price.reduction AS price, stock_available.quantity, product.ean13 AS 'product-id', 'ASIN' AS 'product-id-type', product.condition FROM product, specific_price, stock_available WHERE product.id_product = specific_price.id_product AND product.id_product = stock_available.id_product; Sometimes just asking the question get's the old pumpkin working. Link to comment https://forums.phpfreaks.com/topic/280824-select-help/#findComment-1443429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.