> so it will be like this
> no date price limit
> 01 1/1/05 5000 100
> 02 1/2/05 5010 100
> 03 1/3/05 5020 60 **
> 04 1/6/05 5010 100 **  there are 3 days difference
>
> but how do make a query to check for record no 04 with 03
> how do i retrieved the 1/3/05 date and the price

You actually want the latest price before today.

SELECT * FROM `table_name` WHERE `date` < CURDATE()
will retrieve all prices before today.

SELECT * FROM `table_name` WHERE `date` < CURDATE() ORDER BY `date` DESC
will sort them by date with the latest on top

SELECT * FROM `table_name` WHERE `date` < CURDATE() ORDER BY `date` DESC
LIMIT 1
will only retrieve the latest price before today...

Regards, Jigal.


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

Reply via email to