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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -