MySQL Forums
Forum List  »  German

kleinsten mindestwert ermitteln
Posted by: jens ubert
Date: October 04, 2009 09:18AM

hallo forum,

ich habe eine gewichtstabelle, die z.B. mit Preisen verbunden ist. Ab einem gewissen Gewicht wird ein anderen Preis ausgegeben ...

Bisher habe ich dieses "Problem" mit einem einfachen statement mit

select * tab where gewicht > $vergleichsgewicht limit 1

ermittel. Geht gut und passt.

Nun möchte ich aber diese Abfrage in ein anderes Selectstatement per Join integrieren und suche eine Lösung ohne "limit".

Die entsprechenden Daten sehen z.B. so aus:

id, gewicht, preis
'1','100','5.00'
'2','300','7.00'
'3','600','9.00'
'4','1500','12.00'

... wenn ich jetzt ein vergleichsgewicht von 200g hernehme, dann erhalte ich ohne limit alle ausser id=1. Gibt es eine Möglichkeit mit Vergleichsoperanten auf das Ergebnis: id=2 zu kommen?

Options: ReplyQuote


Subject
Views
Written By
Posted
kleinsten mindestwert ermitteln
3182
October 04, 2009 09:18AM
1731
October 12, 2009 07:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.