select *
from (select t.row_id,
t.supplier_name,
t.tel,
address,
t.contact,
t.contact_post,
t.contact_mobi,
t.contact_tel,
case
when project_supp_type = 0 then
to_number(nvl(t.discount_rate, 0))
when project_supp_type2 = 0 then
to_number(nvl(t.discount_rate2, 0))
when project_supp_type3 = 0 then
to_number(nvl(t.discount_rate3, 0))
when project_supp_type4 = 0 then
to_number(nvl(t.discount_rate4, 0))
when project_supp_type5 = 0 then
to_number(nvl(t.discount_rate5, 0))
when project_supp_type6 = 0 then
to_number(nvl(t.discount_rate6, 0))
end as rate
from md_supplier t
where t.supplier_type = 4
and (project_supp_type = 0 or project_supp_type2 = 0 or
project_supp_type3 = 0 or project_supp_type4 = 0 or
project_supp_type5 = 0 or project_supp_type6 = 0)
and t.status = 1
and exists (select *
from md_project mp, md_project_supplier mps
where mp.row_id = mps.project_id
and mp.status = 1

and supplier_id = t.row_id)
order by rate desc, t.supplier_name)
where rownum <= 5
View Code

相关文章:

  • 2022-01-07
  • 2021-09-21
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-01-16
  • 2021-06-30
猜你喜欢
  • 2021-11-17
  • 2021-12-26
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
相关资源
相似解决方案