http://www.mysql.com/doc/en/example-Maximum-column-group-row.html

might help you do what you're looking for.




On Thu, 1 Jan 2004, Schulman, Michael wrote:

> As far as I know min(price) and max(price) will return the lowest and higest
> price, not the  first and last in the group.  Again I know first and last
> break the paradaigm of SQL's bucket mentality but it is crucial to doing
> timeseries analysis.  And timeseries aggregation as the query I gave is
> trying to do.
>
> Thanks again,
>       Mike
>
> -----Original Message-----
> From: Fredrick Bartlett [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 01, 2004 10:12 PM
> To: Schulman, Michael; [EMAIL PROTECTED]
> Subject: Re: Time series
>
>
> Is Hour a DateTime? If so, will this work...
>
> SELECT ticker, DATE_FORMAT(Hour,'%H' ), min(price), max(price)
> from pricedata
> order by DATE_FORMAT(Hour,'%H' )
> group by DATE_FORMAT(Hour,'%H' )
>
>
> ----- Original Message -----
> From: "Schulman, Michael" <[EMAIL PROTECTED]>
> To: "'Fredrick Bartlett'" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Thursday, January 01, 2004 6:59 PM
> Subject: RE: Time series
>
>
> > That only returns one number.. what we are really looking for is something
> > like
> >
> > SELECT ticker, hour, first(price), last(price) from pricedata group by
> hour
> >
> > Sorry for the confusion.
> >
> > Thanks,
> > Mike
> >
> > -----Original Message-----
> > From: Fredrick Bartlett [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, January 01, 2004 9:57 PM
> > To: Schulman, Michael; [EMAIL PROTECTED]
> > Subject: Re: Time series
> >
> >
> > Hmmm...
> > First: select * from table1 order by field1 asc limit 1
> > Last: select * from table1 order by field1 desc limit 1
> >
> >
> > ----- Original Message -----
> > From: "Schulman, Michael" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, January 01, 2004 6:47 PM
> > Subject: Time series
> >
> >
> > > Hi,
> > >
> > > I work for a large financial instituition.  We are currently evaluating
> > > databases to store intraday stock data.  These are large tables with 40
> > > million rows per day.  We've done some initial testing with MySQL and
> have
> > > been extremely impressed with its speed and ease of use.  I know that it
> > > goes agains the SQL standard but adding a FIRST,LAST aggregate function
> > > along with some other time series functions would allow mysql to compete
> > > with just about any timeseries database, and open up mysql to a huge
> > market
> > > of financial firms.  I know my firm would most likely purchase it.
> Has
> > > anyone developed anyhting like this as an add on?
> > >
> > > Thanks,
> > > Mike
> > >
> >
> > --------------------------------------------------------------------------
> > ----
> > > This message is intended only for the personal and confidential use of
> the
> > > designated recipient(s) named above.  If you are not the intended
> > recipient of
> > > this message you are hereby notified that any review, dissemination,
> > > distribution or copying of this message is strictly prohibited.  This
> > > communication is for information purposes only and should not be
> regarded
> > as
> > > an offer to sell or as a solicitation of an offer to buy any financial
> > > product, an official confirmation of any transaction, or as an official
> > > statement of Lehman Brothers.  Email transmission cannot be guaranteed
> to
> > be
> > > secure or error-free.  Therefore, we do not represent that this
> > information is
> > > complete or accurate and it should not be relied upon as such.  All
> > > information is subject to change without notice.
> > >
> > >
> > > --
> > > MySQL General Mailing List
> > > For list archives: http://lists.mysql.com/mysql
> > > To unsubscribe:
> > http://lists.mysql.com/[EMAIL PROTECTED]
> > >
> >
> >
> >
> > --------------------------------------------------------------------------
> ----
> > This message is intended only for the personal and confidential use of the
> > designated recipient(s) named above.  If you are not the intended
> recipient of
> > this message you are hereby notified that any review, dissemination,
> > distribution or copying of this message is strictly prohibited.  This
> > communication is for information purposes only and should not be regarded
> as
> > an offer to sell or as a solicitation of an offer to buy any financial
> > product, an official confirmation of any transaction, or as an official
> > statement of Lehman Brothers.  Email transmission cannot be guaranteed to
> be
> > secure or error-free.  Therefore, we do not represent that this
> information is
> > complete or accurate and it should not be relied upon as such.  All
> > information is subject to change without notice.
> >
>
>
> ------------------------------------------------------------------------------
> This message is intended only for the personal and confidential use of the
> designated recipient(s) named above.  If you are not the intended recipient of
> this message you are hereby notified that any review, dissemination,
> distribution or copying of this message is strictly prohibited.  This
> communication is for information purposes only and should not be regarded as
> an offer to sell or as a solicitation of an offer to buy any financial
> product, an official confirmation of any transaction, or as an official
> statement of Lehman Brothers.  Email transmission cannot be guaranteed to be
> secure or error-free.  Therefore, we do not represent that this information is
> complete or accurate and it should not be relied upon as such.  All
> information is subject to change without notice.
>
>
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to