锁定老帖子 主题:一个题目,求思路
精华帖 (0) :: 良好帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2011-09-30
下面是一张表:
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2011-09-30
for cur_1 in (select price from youtable where product = 'A') loop
for cur_2 in (select price from youtable where product = 'B') loop for cur_3 in (select price from youtable where product = 'C') loop end loop; end loop; end loop; |
|
返回顶楼 | |
发表时间:2011-09-30
SELECT Aprice||'+'||Bprice|| '+'||Cprice|| '='|| to_char(Aprice+Bprice+Cprice) result FROM (select price AS Aprice from testTable where product='A') , (SELECT PRICE Bprice FROM testTable where product='B') , (SELECT PRICE Cprice FROM testTable where product='C') order by Aprice,Bprice,Cprice |
|
返回顶楼 | |
发表时间:2011-10-01
最后修改:2011-10-01
[quote="wqmgxj"] [code="java"] SELECT Aprice||'+'||Bprice|| '+'||Cprice|| '='|| to_char(Aprice+Bprice+Cprice) result FROM (select price AS Aprice from testTable where product='A') , (SELECT PRICE Bprice FROM testTable where product='B') , (SELECT PRICE Cprice FROM testTable where product='C') order by Aprice,Bprice,Cprice [/code] [/quote]
升级一下:如果其中产品组是可选的呢? 如下:
price product condition(是否可选)
A、B、C三中产品都只选一个结果会有以下情况: 7. 10 + 40 = 50 8. 10 + 50 = 60 9. 10 + 60 = 70 |
|
返回顶楼 | |
发表时间:2011-10-01
(select 0 union (B))
|
|
返回顶楼 | |
浏览 2634 次