List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:February 13 2006 3:53pm
Subject:Re: selecting min, max
View as plain text  
Octavian,

>I need to extract a list which the following values from this table, for
>each hour (in date_time field):

>- symbol
>- min(price)
>- max(price)
>- price where date_time is the earliest for that certain hour.
>- price where the date_time is the last from that hour.
>- The sum of volume from that hour.

Groupwise aggregates again. Very often required & asked about. See 
http://www.artfulsoftware.com/queries.php#18 and 
http://www.artfulsoftware.com/queries.php#19 for two typical answers.

PB
Octavian Rasnita wrote:
> Hi,
>
> I have a table with the following fields:
>
> symbol, date_time, price, volume
>
> I need to extract a list which the following values from this table, for
> each hour (in date_time field):
>
> - symbol
> - min(price)
> - max(price)
> - price where date_time is the earliest for that certain hour.
> - price where the date_time is the last from that hour.
> - The sum of volume from that hour.
>
> I have tried to get the list of symbols, then get each hourly period and
> calculate those 6 values for each period, but there are many symbols and
> very many periods, and it takes very very much time.
>
> Is there a more intelligent way of getting those values in another way than
> symbol by symbol and period by period?
>
> Thank you very much.
>
> Teddy
>
>
>   


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/258 - Release Date: 2/13/2006

Thread
selecting min, maxOctavian Rasnita13 Feb
  • Re: selecting min, maxRhino13 Feb
  • Re: selecting min, maxPeter Brawley13 Feb
  • Re: selecting min, maxOctavian Rasnita13 Feb
    • Re: selecting min, maxleo huang14 Feb
  • Re: selecting min, maxOctavian Rasnita13 Feb
  • Re: selecting min, maxRhino13 Feb