+-----------+--------------+----------+--------+
| ID | Package | Date | Amount |
+-----------+--------------+----------+--------+
| 1 | 2 |2000/09/10| 2000 |
+-----------+--------------+----------+--------+
| 1 | 4 |2002/09/20| 3000 |
+-----------+--------------+----------+--------+
| 1 | 3 |2012/10/01| 5000 |
+-----------+--------------+----------+--------+
| 1 | 4 |2012/10/01| 1000 |
+-----------+--------------+----------+--------+
| 2 | 2 |2012/10/01| 2000 |
+-----------+--------------+----------+--------+
| 2 | 4 |2012/10/01| 5000 |
+-----------+--------------+----------+--------+
| 3 | 2 |2012/10/01| 3000 |
+-----------+--------------+----------+--------+
| 3 | 3 |2012/10/01| 5000 |
+-----------+--------------+----------+--------+
For example, I have this table called 'Packages'.
Every ID is given one package on multiple dates which contain (amount) of items. When an ID receives more than 1 package, there are multiple rows with the same ID.
I would like to select all ID's that have received both Package 2 and 4. In this case, I want mySQL to return ID 1 and 2, since ID 3 only has Package 2 but not 4.
I have used this query:
select
ID
from Packages
where Package = 2 and Package = 4
But when I use this, i get "No Results".
Is there a way to do this? Thanks in advance.