Getting total number of counts for distinct entrys for the same id
First you need to group by ad_id and then group by visitor_ip
then select max for impression, view and click

so your query would look like

SELECT visitor_ip, ad_id,MAX(impression), MAX(view), MAX(clicks)
FROM ad_analytics
GROUP BY ad_id, visitor_ip;


NOTE : You should avoid using reserved keywords as column name.