Skip to content

Instantly share code, notes, and snippets.

@zettamax
Created January 25, 2017 13:54
Show Gist options
  • Save zettamax/d1a9ed3dde3092c515b2ba19c6232a91 to your computer and use it in GitHub Desktop.
Save zettamax/d1a9ed3dde3092c515b2ba19c6232a91 to your computer and use it in GitHub Desktop.
#schema
create table `first` (
`market_id` int unsigned NOT NULL,
`date` datetime NOT NULL,
`value` double NOT NULL
);
#query
select `market_id`, min(`value`) as `min_value`
from `first`
where `date` between '2017-01-03 00:00:00' and '2017-01-04 00:00:00'
group by `market_id`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment