I am having 2 mysql tables -
a) lessee
b) lessee_payment
Using these two tables i want to generate a month wise record of all the lessees for a specific year.
my "lessee" table is like this:
+----+-------+--------+
| id | name | amount |
+----+-------+--------+
| 1 | Amit | 5000 |
| 2 | Sumit | 6000 |
| 3 | Rahul | 4000 |
| 4 | Pooja | 7000 |
| 5 | Raja | 5000 |
+----+-------+--------+
my "lessee_payment" table is like this:
+----+-----------+------------+----------------+
| id | lessee_id | date | collected(Y/N) |
+----+-----------+------------+----------------+
| 1 | 1 | 2016-07-05 | Y |
| 2 | 2 | 2016-07-08 | Y |
| 3 | 3 | 2016-07-05 | N |
| 4 | 1 | 2016-08-05 | Y |
| 5 | 2 | 2016-08-08 | Y |
| 6 | 1 | 2016-09-05 | Y |
| 7 | 2 | 2016-09-05 | Y |
| 8 | 3 | 2016-09-08 | Y |
| 9 | 1 | 2016-10-05 | N |
| 10 | 2 | 2016-10-08 | Y |
| 11 | 3 | 2016-10-07 | Y |
| 12 | 4 | 2016-10-05 | Y |
+----+-----------+------------+----------------+
And month-wise record which i want to show in html table:
+--------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| Lessee | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
+--------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| Amit | - | - | - | - | - | - | Y | Y | Y | N | - | - |
| Sumit | - | - | - | - | - | - | Y | Y | Y | Y | - | - |
| Rahul | - | - | - | - | - | - | N | - | Y | Y | - | - |
| Pooja | - | - | - | - | - | - | - | - | - | Y | - | - |
| Raja | - | - | - | - | - | - | - | - | - | - | - | - |
+--------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Problem is i am unable to show the record in above tabular format.