我想在Order By子句中使用查询,这可能......?
select s.staff_list_pk, s.staff_name, Designation_fn(s.designation_fk)
Designation, s.bps, Department_fn(s.department_fk) Department
from staff_list s
where s.RESERVE = 'N' and s.INTEREST = 'I'
and s.bps in (18,19,20)
and s.department_fk in (select department_fk from perority_dept
where `et_blcok = 'Comp. Engg.')
and s.staff_list_pk not in (select staff_list_fk from SUPERINTENDENT)
order by (select perority from perority_dept where et_blcok = 'Comp. Engg.'), s.bps desc;
答案 0 :(得分:0)
这应该有效。请尝试一次。
with xyz as (SELECT department_fk ,perority
FROM perority_dept
WHERE et_blcok = 'Comp. Engg.'),
klm as (select staff_list_fk
from SUPERINTENDENT)
SELECT s.staff_list_pk,
s.staff_name,
Designation_fn (s.designation_fk) Designation,
s.bps,
Department_fn (s.department_fk) Department
FROM staff_list s , xyz x ,klm k
WHERE s.RESERVE = 'N'
AND s.INTEREST = 'I'
AND s.bps IN (18, 19, 20)
AND s.department_fk = x.department_fk
and s.staff_list_pk <> k.staff_list_fk
order by xyz.perority,s.bps desc;