on 1/1/04 9:59 PM, Schulman, Michael wrote: > 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
Well, if you're using MySQL 4.1+, you're in luck. A subquery should help. SELECT ticker, HOUR(time) AS hour, price FROM pricedata WHERE time IN (SELECT MIN(time), MAX(time) FROM pricedata WHERE HOUR(time) = HOUR(pickatime) ) If you have an older version, simply split it up into two queries and use your middle/front end to handle the intermediate result -- Bob IQ2GI5SCP2 Things You Don't Hear Every Day, #'s 16 and 17: A professor: "It's all right if you come to class high." A(nother) professor: "I think base 16 is cool." -- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]