Say I have these two tables:
+--------+-----+ 
| bookID | Jan | 
+--------+-----+ 
| 1094   | 1   | 
| 1058   | 1   | 
| 984    |  1  | 
+--------+-----+ 
+--------+-----+ 
| bookID | Dec | 
+--------+-----+ 
| 1      | 1   | 
| 2      | 1   | 
+--------+-----+
I would like to get:
+--------+-----+-----+ 
| bookID | Jan | Dec |
+--------+-----+-----+ 
| 1094   | 1   | 0   | 
| 1058   | 1   | 0   | 
| 984    | 1   | 0   | 
| 1      | 0   | 1   | 
| 2      | 0   | 1   | 
+--------+-----+-----+
I was thinking of using join on the id and using union to get bookID's that aren't in both tables, but it seemed inefficient because I would have to do the same for the rest of the months.
Would there be a better way to achieve this from this table:
+----+--------+-----------+--------------+------------+------------+----------+ 
| id | bookID | studentID | checkOutDate | returnDate |  dueDate   | extended | 
+----+--------+-----------+--------------+------------+------------+----------+ 
| 1  | 25     | 1         | 2019-12-09   |  NULL      | 2019-12-25 | 0        | 
| 2  | 357    | 2         | 2019-12-09   | NULL       | 2019-12-25 | 0        | 
| 3  | 365    | 3         | 2019-12-09   | NULL       | 2019-12-25 | 0        | 
| 4  | 984    | 8         | 2019-12-09   | NULL       | 2019-12-25 | 0        |
| 5  | 1094   | 1         | 2019-12-09   | NULL       | 2019-12-25 | 0        | 
| 11 | 99     | 2         | 2019-01-11   | NULL       | 2019-12-10 | 0        | 
| 12 | 1      | 2         | 2019-01-24   | NULL       | 2019-01-11 | 0        | 
+----+--------+-----------+--------------+------------+------------+----------+
I want to display a list of books, and, for each book, 13 columns: 12 columns showing the number of checkouts for each month and a 13th column to display total year checkouts for the book.
 
    