Re: [SQL] Solution to retrieve first and last row for each minute

2007-08-22 Thread Christian Kindler
Its really slow but what you can do is something like the following: select count(a.*), b.* from foo.bar a, ( select price from foo.bar order by time asc limit 1 union select price from foo.bar order by time desc limit 1 ) as b group by b.price ... just do the "wheres" as you need ... Chris

Re: [SQL] Solution to retrieve first and last row for each minute

2007-08-22 Thread roopa perumalraja
Hi Christian, Thanks for your reply. Is it possible to use sub query to do this without using the IF ELSE LOOP? Cheers Roopa Christian Kindler <[EMAIL PROTECTED]> wrote: Hi! Do something like this http://fimi.cvs.sourceforge.net/fimi/database/defaults/indicators/myinttick2bar.

Re: [SQL] Solution to retrieve first and last row for each minute

2007-08-22 Thread Christian Kindler
Hi! Do something like this http://fimi.cvs.sourceforge.net/fimi/database/defaults/indicators/myinttick2bar.sql?revision=1.3&view=markup and replace the max / min calculation with a count calculation. Cheers Chris On Wed, August 22, 2007 9:25 am, roopa perumalraja wrote: > Hi all, > > I ha