I have got two tables:
Event
+----------+---------+--------------+
| event_id | name | date |
+----------+------+-----------------+
| 1 | Event 1 | 26/03/2012 |
+----------+------+-----------------+
| 2 | Event 2 | 27/03/2012 |
+----------+------+-----------------+
Reservation
+----------------+------------+--------------+
| reservation_id | date | themed_id |
+----------------+------------+--------------+
| 1 | 26/03/2012 | 1 |
+----------------+------------+--------------+
| 2 | 26/03/2012 | 1 |
+----------------+------------+--------------+
| 3 | 27/03/2012 | 2 |
+----------------+------------+--------------+
| 4 | 26/03/2012 | 1 |
+----------------+------------+--------------+
How will I display all the events which appear less than 3 times in the reservation table.
The output will be:
+----------+---------+--------------+
| event_id | name | date |
+----------+------+-----------------+
| 2 | Event 2 | 27/03/2012 |
+----------+------+-----------------+
As event two has only appeared once in reservation
thanks
I have not tested but the base idea is this.