mysql function for 2 rows (same name) with group by I have my table:

id   name   salarry   month   year
1    mike   1000      1       2017
2    john   1200      1       2017
3    mike   1100      2       2017
4    mike   900       1       2017


my results now is: 

id   name   sallary   month   year
2    john   1200      1       2017
1    mike   1100      1       2017


I want to show the sallary of mike separatelly by month:

id   name   sallary   month   year
1    mike   1000      1       2017
2    mike   1100      2       2017
3    john   1200      1       2017


the mysql code:

SELECT  `id` ,  `name` , MAX( sallary ) ,  `month` ,  `year` 
FROM  `test` 
GROUP BY  `name` 
LIMIT 0 , 30
depending from what You are looking for, it could be:

SELECT  MIN(`id`) as id,  `name` , MAX( sallary ) as salary ,  `month` ,  `year` 
FROM  `test` 
GROUP BY  `name` ,  `month` ,  `year` 


or because mike have 2 salary in Jan 2017 (and of course it same Mike ;) ):

SELECT  MIN(`id`) as id,  `name` , SUM( sallary ) as salary ,  `month` ,  `year` 
FROM  `test` 
GROUP BY  `name` ,  `month` ,  `year` 


because as unique identifier You choose Name - MIN(id) allow avoid errors when MySQL default settings - ONLY_FULL_GROUP_BY

Specially for Rick James :)

From original question, we can see -  id, can not be used as IDENTIFIER

so queries example with MIN and MAX for id - could be (and this realistic live scenario) - first or most resent contact with person

Before we go to next form of query - first we need decide mike(id=1) for Jan 17 and mike (id=4) for Jan 17, it is same person? and salary for Jan - it MAX or SUM (as I include in my examples).