my title may not explain what I am looking for, this is my current query for pulling in products for a shop:
mysql_query("SELECT * FROM Items
WHERE ((Items.menu_id='$menu_id' AND Items.status='1')
$colour_sql)
$order_sql
LIMIT $lim_from,$limit_per_page");
The part where it says $colour_sql I want to have somthing that says:
AND (Items.id=colour.product_id AND colour.colour='pink')
So it only show products that are pink, with the colours being in a seperate table. I have searched for answers, but I can’t seem to find one explaining my situation, maybe its because I don’t know exactly what i’m, looking for, any help is appreciated thanks.
If you want to join with table
colouryou need to do either a join or a subselect.Join
Subselect