my solution using self join


  • 0
    P
    SELECT sum(distinct i1.TIV_2016) as TIV_2016 FROM insurance i1, insurance i2 where i1.PID != i2.PID AND i1.TIV_2015 = i2.TIV_2015 AND (i1.LAT,i1.LON) NOT IN (
        select LAT, LON FROM insurance GROUP BY LAT, LON HAVING count(*) > 1
    )
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.