Galdor has asked for the wisdom of the Perl Monks concerning the following question:
How do I return the MAX(c) (which is close price)? I have wasted lots of time on this and best I came up with is:create table stocks_daily ( exchange char(10) NOT NULL, symbol char(10) NOT NULL, date datetime NOT NULL, o real NOT NULL, h real NOT NULL, l real NOT NULL, c real NOT NULL, volume int NOT NULL, adjust real NOT NULL );
The syntax is way whacky - This is far more complex than:# get the max: my $high = $quote_model->search( { symbol => $symbol, date => { '>=' => $date}, }, {'select' => [ { max => 'c', } ], } )->single(); print "high: ", $high->c, "\n";
Anyway I always get error "Use of uninitialized value .."select Max(c) from stocks_daily where symbol = '?' and date >= '?'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBIC and Aggregate MAX() Function
by Your Mother (Archbishop) on Dec 05, 2013 at 16:59 UTC | |
by Galdor (Sexton) on Dec 05, 2013 at 17:18 UTC |