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 PS its untested maybe there are some syntax miss-spells -- cu Chris Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings