Jump to content

[SOLVED] Is this query correct


scottybwoy

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

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.