I have a table similar to this: 

```
STOCK_ID TRADE_TIME   PRICE     VOLUME  
123         1           5         100  
123         2           6         150  
456         1           7         200  
456         2           8         250

```

For each stock I want to get latest price (where latest is just the max trade\_time) and aggregated volume, so for the above table I want to see: 

```
123  6 250  
456  8 450 

```

I've just discovered that the current query doesn't (always) work, ie there's no guarantee that the price selected is always the latest: 

```
select stock_id, price, sum(volume) group by stock_id

```

Is this possible to do without subqueries? Thanks!