SELECT DISTINCT w.id, w.menu_disabled,
(CASE WHEN t.lge_id = 'en' THEN t.wtn_name ELSE w.name END) AS name
FROM webpages w LEFT OUTER JOIN webpage_translations t
ON w.id = t.wpe_id
WHERE (CASE WHEN 'en' = 'en' THEN 'en' ELSE COALESCE(t.lge_id,'en') END) = 'en'
AND w.id >= 3000
AND w.id <= 3399
AND w.wpe_id is null
AND (menu_disabled IS NULL OR (menu_disabled != 'DISABLED' AND menu_disabled != 'DISABLED_NO_RIGHT' OR menu_disabled is NULL))
AND (w.menu_disabled IS NULL OR (w.menu_disabled != 'INTERNAL' AND w.menu_disabled != 'INTERNAL_NO_RIGHT')) ORDER BY menu_disabled DESC, id