I already wrote this sql statement to get person id, name and price for e.g. plane ticket.
SELECT Person.PID, Person.Name, Preis
FROM table.flug Flug
INNER JOIN table.flughafen Flughafen ON zielflughafen = FHID
INNER JOIN table.bucht Buchungen ON Flug.FID = Buchungen.FID
INNER JOIN table.person Person ON Buchungen.PID = Person.PID
WHERE Flug.FID = '10' ORDER BY Preis ASC;
My output is correct, but it should only be the line with min(Preis).
If I change my code accordingly, I get an error...
SELECT Person.PID, Person.Name, min(Preis)
FROM table.flug Flug ...
As output I need one single line: PID, Name and Price whereas Price is the min(Preis).
Since you're already sorting your lines, just add a
limit
clause: