開(kāi)始我以為這個(gè)上層查詢(xún)沒(méi)得效果,才發(fā)現(xiàn)他是分層的,有了level
2015-09-02
select new_table.CI_ID CI_ID,wm_concat(new_table.STU_NAME) STU_NAME
from (select c.CI_ID,s.STU_NAME from pm_ci c,pm_stu s where instr(c.STU_IDS,s.STU_ID)>0) new_table
group by new_table.CI_ID;
from (select c.CI_ID,s.STU_NAME from pm_ci c,pm_stu s where instr(c.STU_IDS,s.STU_ID)>0) new_table
group by new_table.CI_ID;
2015-09-01
...我以為這是基礎(chǔ)課程呢,居然起個(gè)名叫高級(jí)查詢(xún),無(wú)語(yǔ)了
2015-08-26
按照入職日期統(tǒng)計(jì)員工人數(shù)
select count(*) Total,
sum(decode(to_char(hiredate,'yyyy'),'1980',1,0)) "1980",
sum(decode(to_char(hiredate,'yyyy'),'1981',1,0)) "1981",
sum(decode(to_char(hiredate,'yyyy'),'1982',1,0)) "1982",
sum(decode(to_char(hiredate,'yyyy'),'1987',1,0)) "1987"
from emp;
select count(*) Total,
sum(decode(to_char(hiredate,'yyyy'),'1980',1,0)) "1980",
sum(decode(to_char(hiredate,'yyyy'),'1981',1,0)) "1981",
sum(decode(to_char(hiredate,'yyyy'),'1982',1,0)) "1982",
sum(decode(to_char(hiredate,'yyyy'),'1987',1,0)) "1987"
from emp;