Q:

How to count max value in one month from 2 table

I have 2 table on my transaction
Table One
id |    date       |   cust_id               |     driver_number
1     2019-01-02          1                         F 3350 NN
2     2019-04-02          2                         AX 111 Z
3     2019-05-02          3                         S 787  X
4     2019-05-02          4                         T 9090 M
5     2019-06-02          3                         P 8989 L

Table Two
driver_number |    price       
F 3350 NN        350000
AX 111 Z         400000
S 787  X         375000
T 9090 M         900000
P 8989 L         500000

How do I count total transaction from two tables above in one month as per requested . 
In example, request for total transaction in May so the result is like below
period         |    total       
May                1275000

Thank you

A:

Using MONTH(T1.date) = 5 and SUM(price) the expected result is achievable
SELECT MONTH(T1.date) AS Period, SUM(price) AS `Total`
FROM TableOne T1
JOIN TableTwo T2 ON T2.driver_number = T1.driver_number
WHERE MONTH(T1.date) = 5
GROUP BY MONTH(T1.date)

