Hi Everybody,
i am working on a project. and i am trying to query three table through [php]INNER JOIN
[/php]…But it i not working…So i want to expose the issue to you…so somebody could help…here is how i design my db
[php]
item table
id_item(PK,AI) item_name (char, 100) item_price(char,10)
1 nike 12000[/php]
[php]groupe table
id_groupe (PK, AI) groupe_name (char, 100)
1 homme[/php]
[php]color table
id_color (PK, AI) name_color(char, 30)
1 white[/php]
[php]item_groupe
it_ID (PK) groupeid(PK)
1 1
[/php]
[php]item_color
itemId(PK) colorId(PK)
1 1
[/php]
So, I want to achieve is to query the tables to sort out the following information about the item:
the item name, item price and item color
. So I run the follwoing sql query.
[php]$sql ="SELECT items.id_item,item_name FROM items INNER JOIN item_color ON item_color.itemId=items.id_item INNER JOIN color ON color.id_color = item_color.colorId INNER JOIN
item_groupe ON item_groupe.it_ID = id_item INNER JOIN groupe ON item_groupe.groupeid = groupe.id_groupe WHERE id_groupe =1";
$stmt = $pdo->prepare($sql);
$stmt->execute();[/php]
Can somebody help!