Jump to content

SELECT help


Go to solution Solved by 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

  • Solution

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.