select yw_seq,sum(bill),sum(louisa),sum(lynn),sum(wang),com_no from (select com_no,yw_seq,decode(person,'0001',(agree)) as lynn,decode(person,'0011',(agree)) as bill,decode(person,'0054',(agree))as wang,decode(person,'0005',(agree)) as louisa from ywht_shenpi group by yw_seq,person,agree,com_no) group by yw_seq,com_no
版權聲明:CSDN是本Blog托管服務提供商。如本文牽涉版權問題,CSDN不承擔相關責任,請版權擁有者直接與文章作者聯系解決。
版權聲明:CSDN是本Blog托管服務提供商。如本文牽涉版權問題,CSDN不承擔相關責任,請版權擁有者直接與文章作者聯系解決。
評論
set serveroutput on;
declare
l_count integer;
begin
for e in (select emp_no,emp_name from cus_emp_basic) loop
select count(*) into l_count from cus_emp_basic
where e.emp_no = emp_no and emp_no = '00006006';
if l_count != 0 then
dbms_output.put_line(e.emp_name);
end if;
end loop;
end;
declare
l_count integer;
begin
for e in (select emp_no,emp_name from cus_emp_basic) loop
select count(*) into l_count from cus_emp_basic
where e.emp_no = emp_no and emp_no = '00006006';
if l_count != 0 then
dbms_output.put_line(e.emp_name);
end if;
end loop;
end;
關于in exists 的區別
select emp_name from cus_emp_basic e
where exists (select 0 from cus_emp_basic where e.emp_no=emp_no and emp_no='00006006');
select emp_name from cus_emp_basic e
where exists (select 0 from cus_emp_basic where e.emp_no=emp_no and emp_no='00006006');
select * from (select rownum r,b.* from cus_emp_basic b where rownum<=3) t where t.r>=1
select * from (select rownum r,b.* from cus_emp_basic b where rownum<=3) t where t.r>=1