select 品名,年月,数量,数量*价格 from sales a,cost b where a.品名=b.品名
union
select 品名,年月,数量,数量*价格 from sales a,(select * from cost where 年月 in
(select min(年月) from cost group by 品名)) where a.品名 not in
(select 品名 from cost)如果错的话请再表达清楚点!
union
select 品名,年月,数量,数量*价格 from sales a,(select * from cost where 年月 in
(select min(年月) from cost group by 品名)) where a.品名 not in
(select 品名 from cost)如果错的话请再表达清楚点!
解决方案 »
- 错误:PLS-00103: 出现符号 "RETURN"在需要下列之一时:
- 求助SQLUnit工具 报错 does not exist in the project "sqlunit".
- oracle中resultset错误
- 求语句,在线等......
- 【查询语句】求这句话该怎么写
- 清问oracle中有没有和sqlserver中从结果集累加的机制,谢谢
- 求一个insert时触发器的写法
- 一个PLSQL问题?
- 在线等待,一个SELECT INTO相关的SQL语句如何写
- 关于oracle中Case 的使用方法??????????????急急急急急急急!!!!!!!!!!!!!
- 遇到一个奇怪的问题
- 简单的触发器问题 在线等待
select 品名,年月,数量*nvl(价格,select min(价格) from cost c where c.品名=t.品名)
from
(select 品名,年月,数量,价格
from sales a,cost b
where a.品名=b.品名(+) and a.年月=b.年月(+)
) t
使用同一品名中年月值最小的价格进行计算???是在Cost表中吗?
select 品名,
年月,
数量 * nvl(价格,
(select 价格
from cost c1
where c1.年月 =
(select min(年月) from cost c where c.品名 = t.品名)))
from (select 品名, 年月, 数量, 价格
from sales a, cost b
where a.品名 = b.品名(+)
and a.年月 = b.年月(+)) t