Jump to content

Recommended Posts

Hi I have two tables, one called products, the other availability.  I want to extract the availability_id_out_of_stock value and use it to get availability_name out of the availability table using the products_id in the products table.  But this statement doesn't work :

SELECT a.availability_name, p.products_quantity
FROM availability a
INNER JOIN products p ON p.availability_id_out_of_stock = a.availability_id
WHERE p.products_id = 51
AND a.language_id = 1

 

So to clarify the tables, I'll draw them out here:

 

Products...

 

products_id  |  availability_id_out_of_stock

-------------------------------------------

51              |          2

52              |          3

 

Availability...

 

availability_id  |  language_id  |  availability_name

--------------------------------------------------

2                  |        1            | Temporarily out of stock

3                  |        1            | 2 - 3 Days

 

Sorry just trying to get my head round Joins, not sure if it the correct one or what way the fields should go.  I'd be greatfull if someone could point me in the right direction.  Thanks.

Link to comment
https://forums.phpfreaks.com/topic/126414-solved-is-this-query-correct/
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.