Subject | Firebird doesn't let me name a column |
---|---|
Author | Andrea Raimondi |
Post date | 2013-03-02T16:41:11Z |
Hello!
I am sure I a missing something, just unsure what :)
This is my query:
SELECT *
FROM (
SELECT EMP. ID, ( EMP.SURNAME||', '||EMP.FIRSTNAME ) FULL_NAME,
DEP.department_name DEPARTMENT, ( 0 ) _A
FROM EMPLOYEES EMP
LEFT OUTER JOIN DEPARTMENTS DEP ON DEP.ID = EMP.DEPARTMENTID
UNION
SELECT ADM. ID, ( ADM.SURNAME||', '||ADM.FIRSTNAME ) FULL_NAME,
DEP.department_name DEPARTMENT, ADM.ADMIN_LEVEL
FROM ADMINISTRATORS ADM
LEFT OUTER JOIN DEPARTMENTS DEP ON DEP.ID = ADM.DEPARTMENTID
)
ORDER BY FULL_NAME, 4
I'd like to assign a field name to the last column in the
upper part of the Union, but Firebird doesn't seem too
keen. What am I missing? Must be something obvious,
surely, but it totally fails me.
Regards,
A
[Non-text portions of this message have been removed]
I am sure I a missing something, just unsure what :)
This is my query:
SELECT *
FROM (
SELECT EMP. ID, ( EMP.SURNAME||', '||EMP.FIRSTNAME ) FULL_NAME,
DEP.department_name DEPARTMENT, ( 0 ) _A
FROM EMPLOYEES EMP
LEFT OUTER JOIN DEPARTMENTS DEP ON DEP.ID = EMP.DEPARTMENTID
UNION
SELECT ADM. ID, ( ADM.SURNAME||', '||ADM.FIRSTNAME ) FULL_NAME,
DEP.department_name DEPARTMENT, ADM.ADMIN_LEVEL
FROM ADMINISTRATORS ADM
LEFT OUTER JOIN DEPARTMENTS DEP ON DEP.ID = ADM.DEPARTMENTID
)
ORDER BY FULL_NAME, 4
I'd like to assign a field name to the last column in the
upper part of the Union, but Firebird doesn't seem too
keen. What am I missing? Must be something obvious,
surely, but it totally fails me.
Regards,
A
[Non-text portions of this message have been removed]