bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 585. Investments in 2016

585. Investments in 2016

Leetcode Solutions

Sum of Unique TIV_ Values with Same TIV_ and Unique Locations

  1. Use a subquery to select tiv_2015 values that appear more than once in the table.
  2. Use another subquery to select unique lat and lon combinations (unique locations).
  3. Filter the original insurance table to include only rows where tiv_2015 is in the list from step 1 and the lat and lon combination is in the list from step 2.
  4. Sum the tiv_2016 values of the filtered rows and round the result to two decimal places.
erDiagram
    Insurance {
        int pid PK
        float tiv_2015
        float tiv_2016
        float lat
        float lon
    }

Alternative Approach: Using JOINs and Derived Tables

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...