Complex Site-Stats Query

Hello,

I’m building statistics for a site and I want to output goal percentages.

What Im trying to achieve is a query to: group all unique ‘ips’, return there max ‘goal’, and add up ip’s based on there goal.

This shows what I’ve done and what it currently returns. Hopefully better to visualize!

If you have any idea ill run through my data to see if it works.

Thanks!