Jump to content

SELECT help


rseigel

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.