tval:tva_id tva_money pos_id
pos: pos_id unit_id
unit: unit_id unit_name结构应该都能看懂吧
希望得到每个单位下每台pos机的统计,查询结果希望是这样的:unit_id unit_name pos money
1 超市1 11 100
12 500
14 300
2 超市2 21 100
25 400
26 700
3 超市3 33 300
pos: pos_id unit_id
unit: unit_id unit_name结构应该都能看懂吧
希望得到每个单位下每台pos机的统计,查询结果希望是这样的:unit_id unit_name pos money
1 超市1 11 100
12 500
14 300
2 超市2 21 100
25 400
26 700
3 超市3 33 300
解决方案 »
- vmware2.02+oraclg10g RAC+linux5.1虚拟机自动关机的问题
- OracleDBConsoleorcl服务启动不了!
- oracle服务启动
- 求解:我使用的Oracle 9i + c#开发一个程序,oracle.exe进程所占用的内存不断地缓慢增长!~
- 大家最近都在学什么呢?
- 求助,我想写一个存储过程来完成调用java的.class程序!请问怎么能实现?在线等,急!!!
- 求助,无法为实体化视图设置on commit刷新属性
- 请教这条sql语句的含义是什末?来者有分
- 请问在进入instance manager时的username和password指的是哪个呀
- 含有execute immediate 'insert into test001 values(1,''jd'')'的过程被调用时提示:insufficient privilege .
- PRO*C预编译成功, 但是生成的cpp文件编译出错!
- cursor能否查找包括null字段的表
where a.unit_id =b.unit_id and b.pos_id=c.pos_id
group by a.unit_id,a.unit_name,b.pos_id
insert into ta select 1,'a1' from dual;
insert into ta select 1,'a2' from dual;
insert into ta select 1,'a3' from dual;
insert into ta select 1,'a4' from dual;
insert into ta select 2,'a1' from dual;
insert into ta select 2,'a2' from dual;
insert into ta select 3,'a3' from dual;
insert into ta select 3,'a4' from dual;
commit;select a.*,case when lag(id)over(partition by id order by id) is null then a.id
else null end as newid,a.name from ta a;
FROM Unit u
RIGHT JOIN
(SELECT p.uuit_id,p.pos_id AS pos,t.tva_money AS money FROM Tval t ,Pos p WHERE t.pos_id = p.pos_id ORDER BY p.pos_id) pt
WHERE pt.uuit_id=u.uuit_id
ORDRE BY u.uuit_id;应该是这样!