select * from (select * from emp order by sal desc)where rownum<=3這樣也是可以的
2018-08-22
select p.ci_id,max(stu_name) as STU_NAME
from (select c.ci_id,wm_concat(s.stu_name)
over(partition BY c.stu_ids order by s.stu_id) as stu_name
from pm_ci c,pm_stu s
where instr(c.stu_ids,s.stu_id) > 0) p
group by p.ci_id
查詢出來后有排序效果的
from (select c.ci_id,wm_concat(s.stu_name)
over(partition BY c.stu_ids order by s.stu_id) as stu_name
from pm_ci c,pm_stu s
where instr(c.stu_ids,s.stu_id) > 0) p
group by p.ci_id
查詢出來后有排序效果的
2018-08-17
拿走,不謝,已測試通過
select t3.ci_id as CI_ID,
wm_concat(t3.stu_name) as STU_NAME
from
(
select t1.ci_id,t2.stu_name
from pm_ci t1 cross join pm_stu t2
where instr(t1.stu_ids,t2.stu_id)>0
) t3
group by t3.ci_id;
select t3.ci_id as CI_ID,
wm_concat(t3.stu_name) as STU_NAME
from
(
select t1.ci_id,t2.stu_name
from pm_ci t1 cross join pm_stu t2
where instr(t1.stu_ids,t2.stu_id)>0
) t3
group by t3.ci_id;
2018-07-08
select ci_id,wm_concat(stu_name) stu_name
from pn_ci a,pm_stu b
where instr(stu_ids,stu_id)>0
group by ci_id;
from pn_ci a,pm_stu b
where instr(stu_ids,stu_id)>0
group by ci_id;
2018-06-28
select c.ci_id,wm_concat(s.stu_name) stu_name
from pm_ci c left outer
join pm_stu s on c.stu_ids=s.stu_id
group by c.ci_id;
from pm_ci c left outer
join pm_stu s on c.stu_ids=s.stu_id
group by c.ci_id;
2018-06-15
SELECT CI_ID,TO_CHAR(WM_CONCAT(STU_NAME)) STU_NAMES
FROM (SELECT * FROM PM_CI,PM_STU
WHERE INSTR(STU_IDS,STU_ID)<>0)
GROUP BY CI_ID
FROM (SELECT * FROM PM_CI,PM_STU
WHERE INSTR(STU_IDS,STU_ID)<>0)
GROUP BY CI_ID
2018-06-01
SELECT CI_ID,WM_CONCAT(STU_NAME) STU_NAMES
FROM (SELECT CI_ID,STU_NAME FROM PM_CI,PM_STU
WHERE INSTR(STU_IDS,STU_ID)<>0) GROUP BY CI_ID,結(jié)果是正確的,可是出現(xiàn)了一個問題,STU_NAMES字段顯示(HUGECLOB),只有點開后面的省略號才能看到字符串值,求解答
FROM (SELECT CI_ID,STU_NAME FROM PM_CI,PM_STU
WHERE INSTR(STU_IDS,STU_ID)<>0) GROUP BY CI_ID,結(jié)果是正確的,可是出現(xiàn)了一個問題,STU_NAMES字段顯示(HUGECLOB),只有點開后面的省略號才能看到字符串值,求解答
2018-06-01
--oracle 右連接
Select d.deptno,d.dname,Count(e.empno) from emp e,dept d
Where e.deptno(+) = d.deptno
Group By d.deptno,d.dname
--mysql 右連接
Select d.deptno,d.dname,Count(e.empno)
from emp e Right Join dept d On e.deptno= d.deptno
Group By d.deptno,d.dname
Select d.deptno,d.dname,Count(e.empno) from emp e,dept d
Where e.deptno(+) = d.deptno
Group By d.deptno,d.dname
--mysql 右連接
Select d.deptno,d.dname,Count(e.empno)
from emp e Right Join dept d On e.deptno= d.deptno
Group By d.deptno,d.dname
2018-05-27
select deptno,listagg(ename,',') within group (order by deptno) enameList from emp group by deptno;
2018-05-16