'Why is this SQL statement (SELECT * FROM items WHERE id=2) returning only the first instance?

I have the following table:

items:
id |color| price
1   red   10
2   red   11
2   blue  11.5
3   green 9

id and color make up the key. i want to return all items with id=2.

I tried using this statement

SELECT * FROM items WHERE id=2

but the output is only

Array([id] => 2 [color] => red [price]=>11)

Why doesnt it return both of the items of id = 2 (the red and blue) as expected? How do I return all items with id=2??



Solution 1:[1]

This should not be possible because a primary key is unique so you should only have one item with the id of 2.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Achraf Bardan