View Single Post

   
  #1 (permalink)  
Old 03-17-2008, 06:13 AM
Karlheinz Klingbeil
 
Posts: n/a
Default Need Help with select

Hi there,
I am banging my head against the wall because i cannot figure out
what select statement to use in the following case (or if it is even
possible ?!)

I have a table called "buchungen", and the columns "rezeptur_id" (int) und "datum"(date)
for each "rezeptur_id" there are a variable count of rows, all of which have a
different "datum" (means date)

My goal is to select the newest row for not only one "rezeptur_id", but fora list of different
"rezeptur_id"s.

The query

"select datum from buchungen where rezeptur_id=10 order by datum desc limit 1;"

would give me the latest row for "rezeptur_id" 10 (by the way, can this be done another way ? max(datum)
doesn't seem to work properly here ?!?)

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 datumdesc limit 1;

is obviously the wrong approac

Thank you for reading...

--
Greetz, lunqual - http://www.lunqual.de
http://www.42pixels.de - Bilder
http://www.rezeptbuch-pro.de - Software für den Destillateur
Reply With Quote