I have the following columns name, rank, created_date in table1.
I would like to
SELECT
name,
rank for latest created_date,
latest created_date,
difference between rank current created_date & previous date
FROM
table1
There is only one record per person per created_date.
Output should be:
Sam 15 2011/10/05 -3
Thanks for your help.
Edit: Re-reading your question, I think you want to get one output row per person, with the difference computed between the last two records for that person. If so, a slightly more complicated solution is needed: