从品牌网站建设到网络营销策划,从策略到执行的一站式服务
select a.id,a.name,nvl(sum(b.quantity),0) quantity from a,b where a.id=b.id(+) group by a.id,a.name
创新互联公司是一家专注于网站建设、成都做网站与策划设计,南召网站建设哪家好?创新互联公司做网站,专注于网站建设十余年,网设计领域的专业建站公司;建站业务涵盖:南召等地区。南召做网站价格咨询:18982081108
我回答的比楼上早,忘记加group by了,呵呵
oracle中使用排名函数来完成类似的需求。
--使用ROW_NUMBER()
select * from
(
select stuID,stuName,age ,ROW_NUMBER() OVER (ORDER BY stuID desc) RN
from Student
) NewData
where RN BETWEEN 2 AND 5 or RN BETWEEN 6 AND 8
你这个问题解决了.
结果如图的形式.
SELECT MAX(DECODE(B.NO, 1, A.NUM1, NULL)) NUM1,
MAX(DECODE(B.NO, 1, A.NUM2, NULL)) NUM2,
MAX(DECODE(B.NO, 2, A.NUM1, NULL)) NUM1,
MAX(DECODE(B.NO, 2, A.NUM2, NULL)) NUM2,
MAX(DECODE(B.NO, 3, A.NUM1, NULL)) NUM1,
MAX(DECODE(B.NO, 3, A.NUM2, NULL)) NUM2,
MAX(DECODE(B.NO, 4, A.NUM1, NULL)) NUM1,
MAX(DECODE(B.NO, 4, A.NUM2, NULL)) NUM2,
MAX(DECODE(B.NO, 5, A.NUM1, NULL)) NUM1,
MAX(DECODE(B.NO, 5, A.NUM2, NULL)) NUM2
FROM TABLE1 A, TABLE2 B
WHERE A.NUM = B.NUM;
select 员工号、lastname、工资 from (
select 员工号、lastname、工资 from 表 order by 工资 desc )
where rownum=2
-- 先取并集,然后查询student2是否两条(根据id排序)
SELECT student FROM (SELECT student FROM A union SELECT student FROM B) a1,A a2 WHERE a2.student=a1.student and (SELECT count(*) FROM B GROUP BY student) = 2;
-- 或者
SELECT * FROM A a, B b WHERE a.student=b.student ORDER BY b.student HAVING COUNT(*)=2;
成都网站建设公司地址:成都市青羊区太升南路288号锦天国际A座10层 建设咨询028-86922220
成都快上网科技有限公司-四川网站建设设计公司 | 蜀ICP备19037934号 Copyright 2020,ALL Rights Reserved cdkjz.cn | 成都网站建设 | © Copyright 2020版权所有.
专家团队为您提供成都网站建设,成都网站设计,成都品牌网站设计,成都营销型网站制作等服务,成都建网站就找快上网! | 成都网站建设哪家好? | 网站建设地图