INNER JOIN, Duplicate removal
===

I have two tables

    Product table
    productid   int
    productname varchar(32)

and 

    productprice table
    productid    int
    effectiviedt date
    inactivedt   date
    price        decimal (10,2)

i have a bunch of records
some products has duplicate effectivedt
what i want to do is for each record
find the duplicate effectivedt and only keep the longest running one the inactivedt is also a date so the length would be form the effectivedt to the inactivedt

i have been trying to do it for a while but have had no luck what so ever.

i started with try to find at the earliest dates but realised that doesn't work becuase the duplicates may not be earliest dates

i cant find a way to get the difference between effectivedt and inactivedt as i cant have it in the where or having or on clause

so ye i been trying for a good long whi,e no to no avail any help would make me cry with thankfullness 

thanks you in advance