View Single Post

   
  #4 (permalink)  
Old 03-17-2008, 06:13 AM
Luuk
 
Posts: n/a
Default Re: Need Help with select

Erick T. Barkhuis schreef:
> Karlheinz Klingbeil:
>
>> So the question is, how can i retrieve this newest row for a list of "rezeptur_id"s ?
>>
>> "select datum from buchungen where rezeptur_id in (10,20,30) order by datum desc limit 1;

>
> Not tested:
>
> select max(datum)
> from buchungen
> where rezeptur_id in (10,20,30)
> group by rezeptur_id
> order by rezeptur_id
>


select rezeptur_id, max(datum)
from buchungen
group by rezeptur_id
order by rezeptur_id

it think OP needs this, because he wrote:
"My goal is to select the newest row for not only one "rezeptur_id", but
for a list of different "rezeptur_id"s."...

--
Luuk
Reply With Quote