Christian Seiler: verkniffelte MySQL-Anfrage

Beitrag lesen

Hallo BaJu,

SELECT DISTINCT
Produktionen.ID
FROM
Produktionen, Termine
WHERE
Termine.Datum < NOW() AND
Termine.ID_Produktion = Produktionen.ID
ORDER BY Produktionen.Headline

SELECT
  Produktionen.ID,
  Produktionen.Headline,
  MAX(Termine.Datum) AS LetzterTermin
FROM
  Produktionen,
  Termine
WHERE
  Termine.ID_Produktion = Produktionen.ID
GROUP BY
  Produktionen.ID
HAVING
  LetzterTermin < NOW()
ORDER BY Produktionen.Headline

Siehe auch: http://aktuell.de.selfhtml.org/tippstricks/datenbanken/having/index.htm

Viele Grüße,
Christian

--
Losung und Lehrtext für Freitag, 24. Oktober 2003:
Der Herr lebt! Gelobt sei mein Fels! (Psalm 18,47)
Zu Christus kommt als zu dem lebendigen Stein, der von den Menschen verworfen ist, aber bei Gott auserwählt und kostbar. (1.Petrus 2,4)
(http://www.losungen.de/heute.php3, i.V. Götz)