Skip to content

Instantly share code, notes, and snippets.

@ccarpenterg
Created June 16, 2010 04:26
Show Gist options
  • Save ccarpenterg/440162 to your computer and use it in GitHub Desktop.
Save ccarpenterg/440162 to your computer and use it in GitHub Desktop.
mysql> select a.*
from acciones a
inner join (
select symbol, max(price) as high
from acciones
group by symbol
) b on a.price = b.high and a.symbol = b.symbol;
+------------+------------+----------+------------+
| symbol | price | volume | date |
+------------+------------+----------+------------+
| ALMENDRAL | 57.5000 | 2431853 | 2009-06-15 |
| ANDINA-B | 2098.9000 | 97222 | 2010-06-14 |
| ANTARCHILE | 10500.0000 | 51244 | 2010-02-19 |
| ANTARCHILE | 10500.0000 | 11151 | 2010-02-22 |
| BCI | 21832.0000 | 69329 | 2010-04-08 |
| BSANTANDER | 35.5500 | 43011404 | 2010-04-07 |
| BSANTANDER | 35.5500 | 69963128 | 2010-04-08 |
| BSANTANDER | 35.5500 | 15366125 | 2010-04-09 |
| CALICHERAA | 975.0000 | 1531987 | 2010-06-03 |
| CAP | 17342.0000 | 731090 | 2010-01-18 |
| CCU | 4888.6000 | 133893 | 2010-06-14 |
| CENCOSUD | 2371.3999 | 3564930 | 2010-06-02 |
| CGE | 3680.0000 | 56946 | 2009-06-11 |
| CHILE | 55.8800 | 60237896 | 2010-03-16 |
| CMPC | 24332.0000 | 112349 | 2010-06-15 |
| COLBUN | 143.5000 | 31608932 | 2009-06-16 |
| CONCHATORO | 1250.5000 | 154027 | 2010-02-18 |
| COPEC | 8597.2002 | 633964 | 2010-02-01 |
| CORPBANCA | 4.8870 | 65549081 | 2010-06-15 |
| ECL | 1075.2000 | 189355 | 2010-04-07 |
| ENDESA | 924.7300 | 7672615 | 2010-02-03 |
| ENERSIS | 244.3600 | 37291388 | 2010-02-03 |
| ENTEL | 7937.7998 | 127102 | 2009-06-12 |
| FALABELLA | 3477.6000 | 463009 | 2010-06-11 |
| GENER | 256.8900 | 6728007 | 2010-02-02 |
| IAM | 699.9000 | 452425 | 2010-05-04 |
| LA POLAR | 3236.7000 | 635141 | 2010-02-26 |
| LAN | 10408.0000 | 239598 | 2010-06-15 |
| MADECO | 40.9900 | 10066874 | 2009-06-12 |
| MASISA | 84.0800 | 55630736 | 2010-03-05 |
| MULTIFOODS | 155.9300 | 16985828 | 2010-05-26 |
| NORTEGRAN | 8.2003 | 27802572 | 2009-06-11 |
| ORO BLANCO | 9.2748 | 60366224 | 2009-08-25 |
| PARAUCO | 759.5300 | 928644 | 2010-04-09 |
| PROVIDA | 1733.0000 | 269289 | 2010-05-18 |
| RIPLEY | 564.7400 | 1546688 | 2010-06-14 |
| SALFACORP | 1235.1000 | 1677950 | 2010-03-29 |
| SK | 580.0000 | 119605 | 2010-06-15 |
| SM-CHILE B | 95.7700 | 3108714 | 2010-05-10 |
| SOCOVESA | 256.0000 | 1340739 | 2010-03-26 |
| SONDA | 831.8500 | 767851 | 2010-01-20 |
| SQM-B | 21839.0000 | 423615 | 2009-06-11 |
| VAPORES | 520.3600 | 4685806 | 2010-06-11 |
+------------+------------+----------+------------+
43 rows in set (0.02 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment