Hard to describe what i want, but I will try: First of all, i have 2 tables: employee and salary. I joined 2 tables by this SQL command:
"SELECT employee.id, employee.employee_name, employee.image, salary.year, salary.month, salary.day, salary.total_salary, salary.id, salary.created
                        FROM employee
                 JOIN salary ON salary.employee_id=employee.id"
to get all value i inserted, after execute, i got:
Created              name    year     month   day(working)       total_salary
------------------------------------------------------------------------------
2016-12-17 20:41      A      2016       1         31              1550000
2016-12-17 21:49      A      2016       1         20              2000000
2016-12-17 22:49      A      2016       2         20              2000000
2016-12-18 22:43      B      2016       2         15              1550000
2016-12-18 23:43      B      2016       2         10              1000000
2016-12-18 23:49      B      2016       2         1                100000
After that, i want to get the newest value per month, so i add this command to the end of sql above:
 GROUP BY employee.employee_name, salary.year, salary.month"
and got this:
Created              name    year     month   day(working)       total_salary
------------------------------------------------------------------------------
2016-12-17 20:41      A      2016       1         31              1550000
2016-12-17 22:49      A      2016       2         20              2000000
2016-12-18 22:43      B      2016       2         15              1550000
What query will return the following result?
Created              name    year     month   day(working)       total_salary
------------------------------------------------------------------------------
2016-12-17 21:49      A      2016       1         20              2000000
2016-12-17 22:49      A      2016       2         20              2000000
2016-12-18 23:49      B      2016       2         1                100000
 
     
     
     
    