In this case you would need to add a timestamp and check for the latest 
timestamp. This price should be taken for your query. Something like

SELECT * FROM food WHERE timestamp(MAX);


Thats my guess - anybody please correct me if I talk rubbish here


Best regards

Nils Valentin
Tokyo/Japan

2003年 6月 2日 月曜日 08:17、Mateusz さんは書きました:
> That'd be the solution, but unfortunately i gave You incorrect example (too
> little rows):
> the problem is I don't have a constant number of foods. For example the
> latest price of tomatoes could be from day 20 but the last price of
> potatoes might be from day 19, and for onions from day 1. I need single
> most recent row for each type of food that has appeared in database.
>
> ----- Original Message -----
> From: "Becoming Digital" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, June 02, 2003 12:28 AM
> Subject: Re: SELECTing last occurences from a table
>
> > Do you have daily prices for a set number number of foods?  If so, try
> >
> > SELECT * FROM food
> >     LIMIT n,-1;
> >
> > where n is the number of items.  There's probably a better way to do it
> > in
>
> SQL,
>
> > I just don't know how.  If you are using PHP, that's another story.

-- 
================================================
Valentin Nils
Internet Technology

 E-Mail: [EMAIL PROTECTED]
 URL: http://www.knowd.co.jp
================================================


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

Reply via email to