So you trying to group data by multiple column here and you’re using MySQL? There is no native way to do that, you have to combine ‘Group By’ syntax with other else.

Regular Group by would be like this:

select client_id, name, max(cash + stocks)
from client join portfolio using (client_id)
group by client_id

+-----------+----------+--------------------+
| client_id | name     | max(cash + stocks) |
+-----------+----------+--------------------+
|         1 | John Doe |              33.33 | 
|         2 | Jane Doe |              90.90 | 
+-----------+----------+--------------------+

to group by two column, you need to concat those two column first, your syntax will be like this:

select client_id, name, max(cash + stocks)
from client join portfolio using (client_id)
group by concat(client_id,name)

Understand now?

God bless your SQL…