My DB table column values are
tenant_ id group_id
2 2-100
2 2-111
1 1-222
1 1-888
2 2-999
2 2-1000
Query :
select max(group_id) from prospect_group where tenant_id=2
I have used the above query to get the max value for tenant_id=2 but it returns the value as 999 instead of 1000. How to get 1000 as the max value.??? Can anyone help me..???
You need to have
GROUP BYclausetry it by replacing to an empty char.
SQLFiddle Demo