Doofie: SQL = ORDER BY wird ignoriert ... warum?

Beitrag lesen

SELECT id, end AS datey, 'E' FROM union_dev WHERE end > NOW()
UNION
SELECT
  CASE
    WHEN str > prs THEN id
    WHEN str < prs THEN id
    WHEN str IS NULL AND prs IS NULL THEN id
  END,
  CASE
    WHEN str > prs THEN str
    WHEN str < prs THEN prs
    WHEN str IS NULL AND prs IS NULL THEN '0000-00-00'
  END AS datey,
    CASE
    WHEN str > prs THEN 'S'
    WHEN str < prs THEN 'P'
    WHEN str IS NULL AND prs IS NULL THEN 'N'
  END
FROM union_dev
WHERE end < NOW() OR end IS NULL
ORDER BY datey DESC;

  
Hilft das?