> select
> substring_index(max(concat(lpad(day,4,'0'),'|',name,'|',id,'|',price)),'
> |',1) + 0 as day,
>
> substring_index(substring_index(max(concat(lpad(day,4,'0'),'|',name,'|',
> id,'|',price)),'|',2),'|',-1) as name,
>
> substring_index(substring_index(max(concat(lpad(day,4,'0'),'|',name,'
'|',price)),'|',2),'|',-1) as name,
->
substring_index(substring_index(max(concat(lpad(day,4,'0'),'|',name,'|',
id,'|',price)),'|',3),'|',-1) as id,
->
substring_index(substring_index(max(concat(lpad(
t; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, 01 June, 2003 22:10
Subject: Re: SELECTing last occurences from a table
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
;t using a scripting language.
Edward Dudlik
Becoming Digital
www.becomingdigital.com
- Original Message -
From: "Mateusz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, 01 June, 2003 19:55
Subject: Re: SELECTing last occurences from a table
I believe you are at minimum talking about a subselect command here.
I am just about to get the idea what you really want. You want to request all
updated prices f.e. to show a pricelist with the newest prices.
I guess thats to high for me to reach right now - but definitely interesting
;-)
Be
ent: 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&
> SELECT * FROM myTable ORDER BY COLUMN_WHICH_CONTAINS_INSERTED_DATE ASC
LIMIT
> 1;
> COLUMN_WHICH_CONTAINS_INSERTED_DATE is a column which contains the date
that
> the record was inserted
This would only select one row (the most recent). I need a set of rows, one
for _each_ type of food (one and
CTED]>
Sent: Sunday, June 01, 2003 7:17 PM
Subject: Re: SELECTing last occurences from a table
> 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 pr
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.
Edward Dudlik
Becoming Digital
www.becomin
10 matches
Mail list logo