Oracle sucks

Материал из YourcmcWiki
Версия от 14:09, 23 марта 2011; VitaliyFilippov (обсуждение | вклад) (Новая страница: «<pre>SELECT "alias6".birth_date AS "col4", "alias6".e_category AS "col5", "alias6".id_chief AS "col6", "alias6".id_department AS "col7", "alias6".fire_date AS "col8"...»)

(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск
SELECT
"alias6".birth_date AS "col4",
"alias6".e_category AS "col5",
"alias6".id_chief AS "col6",
"alias6".id_department AS "col7",
"alias6".fire_date AS "col8",
"alias6".first_name AS "col9",
"alias6".hire_date AS "col10",
"alias6".id_employee AS "col11",
"alias6".last_name AS "col12",
"alias6".dtm_modified AS "col13",
"alias6".salary AS "col14",
"alias6".e_sex AS "col15",
"alias6".id_product AS "col16"
FROM
(
SELECT
"alias1".id_employee as "col123",
CASE WHEN (EXISTS
(
SELECT
'1' AS "col1"
FROM
t_employee "alias2"
WHERE
"alias2".id_chief = "alias1".id_employee
)
) THEN ("alias1".id_employee) ELSE ("alias1".id_chief) END AS "col2"
FROM
t_employee "alias1"
/* ORDER BY
"alias1".id_employee */
) "alias4"
LEFT JOIN
(
t_employee "alias3"
LEFT JOIN
(
t_employee "alias5"
LEFT JOIN
t_employee "alias6"
ON "alias5".id_chief = "alias6".id_employee
)
ON "alias3".id_chief = "alias5".id_employee
)
ON "alias4"."col2" = "alias3".id_employee
order by "alias4"."col123"