mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-25 22:38:04 +02:00
You cannot use MAX() in a WHERE clause, instead use a subquery. The ORDER BY is also unneeded, because we only select the maximum. So what to order, there is only one number (even if multiple entries with the same number).
4 lines
186 B
SQL
4 lines
186 B
SQL
SELECT berater_id, name, anzahl
|
|
FROM Beratungsanzahl
|
|
JOIN Berater ON Berater.berater_id = Beratungsanzahl.berater_id
|
|
WHERE anzahl = (SELECT MAX(anzahl) FROM Beratungsanzahl)
|