sql - Get Latest Rates For Each Distinct Rate Name -



sql - Get Latest Rates For Each Distinct Rate Name -

ratename rate effectivedate -------- ---- ------------- rateone 400 2011-01-05 rateone 410 2011-06-31 ratetwo 147 2010-09-21 ratethree 68 2011-07-14 ratetwo 100 2011-10-30

if have info such above, how can run query such i'll have these results:

ratename rate effectivedate -------- ---- ------------- rateone 410 2011-06-31 ratethree 68 2011-07-14 ratetwo 100 2011-10-30

basically, need latest rates each distinct rate name.

you can seek this:

select a.* yourtable inner bring together ( select ratename, max(effectivedate) maxdate yourtable grouping ratename) b on a.ratename = b.ratename , a.effectivedate = b.maxdate

sql db2

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

ms access - C# - Using OleDbParameter on table name -