mysql - SQL get the latest records from a set of data -


so have table of holdings each holding has date column. e.g.

id   |   holding_name   |   value   |   holding_date ---------------------------------------------------- 1    |   ishares msci   |   2032    |   2013-12-31 2    |   vanguard bonds |   5332    |   2013-12-31 3    |   ishares msci   |   2241    |   2014-01-31 4    |   vanguard bonds |   6236    |   2014-01-31 

if wanted select latest holdings go

select * holdings holdings.holding_date = '2014-01-31' 

but if don't know latest date 2014-01-31? there way build query?

select * holdings holding_date = (select max(holding_date) holdings) 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -