select code,amt,id,name
專注于為中小企業(yè)提供成都做網(wǎng)站、網(wǎng)站設(shè)計、外貿(mào)營銷網(wǎng)站建設(shè)服務(wù),電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)左云免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了超過千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。
from (
select id,name,p.code,p.amt,
row_number() over (partition by p.code order by id asc) rn
from (
select id,name,sum(amount) over (order by id) as new_amount
from table_name
) t,
(select 'A' code,1000 amt from dual
union all
select 'B',10000 from dual
union all
select 'C',50000 from dual
union all
select 'D',100000 from dual) p
where t.new_amount=p.amt
) a
where rn=1
你那個pubdate格式是什么樣的?
20101101還是2010-11-01
還有,你后邊要顯示什么格式列舉一下不好么?
--補充--
select a.date_money,b.month_money,c.year_money from
(select sum(nvl(money,0)) date_money from test where pubDate ='2010-11-01') a,
(select sum(nvl(money,0)) month_money from test where pubDate like '2010-11%' and pubDate'2010-11-02') b,
(select sum(nvl(money,0)) year_money from test where pubDate like '2010%' and pubDate'2010-11-02') c
以上以2010年11月2日為例 ,取的昨天的銷售錢數(shù),月和年里則去掉了當(dāng)天的錢數(shù)
SQL select * from orderr;
PRODID ORDID ORDERDATA
---------- ---------- --------------
1 100 01-1月 -12
2 200 01-1月 -12
SQL select * from PRODUCT;
PRODID PROD
---------- ----
1 車
2 床
SQL select * from ORDERDETAIL;
PRODID PRICE COUNT ORDID
---------- ---------- ---------- ----------
1 50000 10 100
2 30000 15 200
SQL select "PRODUCT"."PRODNA" "產(chǎn)品名稱","ORDERR"."ORDERDATA" "訂購日期","ORDERDETAIL"."PRICE"*"ORDERDETAIL"."COUNT" "產(chǎn)品銷售額",
2 to_char("ORDERR"."ORDERDATA",'q') "訂購季度"
3 from PRODUCT,ORDERDETAIL,ORDERR
4 where "PRODUCT"."PRODID"="ORDERDETAIL"."PRODID" AND "ORDERDETAIL"."ORDID"="ORDERR"."ORDID"
5 group by "ORDERR"."ORDERDATA","ORDERDETAIL"."PRICE"*"ORDERDETAIL"."COUNT",to_char("ORDERR"."ORDERDATA",'q'),"PRODUCT"."PRODNA";
產(chǎn)品 訂購日期 產(chǎn)品銷售額 訂購季度
---- -------------- ---------- ----------
床 01-1月 -12 450000 1
車 01-1月 -12 500000 1
有什么問題?
另外說一下:
1、你“產(chǎn)品名稱”前面的雙引號有問題。
2、在雙引號引用中是必須區(qū)分大小寫的。
3、orderdata前的表名呢?
select t.*,
case
when t.百分比 0.7 then
'A'
when t.百分比 = 0.7 and t.百分比 = 0.9 then
'B'
when t.百分比 0.9 then
'C'
end acb
from (select z.plucode, z.pluname, z.hxtoal,
sum(z.hxtoal) over(order by z.hxtoal desc) 累加,
round(sum(z.hxtoal) over(order by z.hxtoal desc) /
(select sum(z.hxtoal) from z), 3) 百分比
from z) t
select sum(銷售額) from 對應(yīng)表
where to_char(銷售日期,'yyyy')='2010'
分享名稱:關(guān)于Oracle怎么查銷售額的信息
URL分享:http://muchs.cn/article18/hjshdp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機網(wǎng)站建設(shè)、、小程序開發(fā)、面包屑導(dǎo)航、網(wǎng)站設(shè)計、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)