SELECT price FROM mytable WHERE price <= theprice DESC LIMIT 1;

-----Original Message-----
From: Alejandro Zuzenberg [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 01, 2001 7:53 PM
To: [EMAIL PROTECTED]
Subject: Can I use the concept of Effective Date with MySQL?


I need to select the appropriate price for a product in a table, and the
product has a compund key with 2 fields: product number and date.
For every transaction with a certain product, I need to retrieve the price
that was 'current' at the specific time when that transaction took place.

In joining two tables, I need to relate the price of a product to every
sales transaction where that product was used, not only by product number
but also by the effective date for that price.

How can  I do this? Is there a 'closest' function (the highest value that is
< or = ) to be used in a WHERE statment ?
I've been searching for this for hours and could not fnd a solution with
MySql.

Thanks!
Alejandro
[EMAIL PROTECTED]


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to