|
|
劭鵬
銅驢友〔高級〕
. 積分: 193
. 文章: 702
. 收花: 1316 支
. 送花: 1043 支
. 比例: 0.79
. 在線: 1098 小時
. 瀏覽: 5762 頁
. 註冊: 8214 天
. 失蹤: 1231 天
|
|
|
|
|
|
|
#1 : 2005-5-21 02:27 PM
全部回覆
|
送花
(0)
送出中...
|
|
|
不好意思...貼在這個版不知道對不對...如果貼錯地方了...還煩請熊大移版!
以下便是小弟想請問各位大大的問題...
@createdate 這個參數的值為 '2005/05',因為要撈出這個月份每天的金額,問題就是要如何撈出這個月份包含前12個月(共13個月)每天的金額呢?如何將 @createdate 這個參數的值變為 '2005/04'、'2005/03'、'2005/02'...
SELECT
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/01') AS V001,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/02') AS V002,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/03') AS V003,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/04') AS V004,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/05') AS V005,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/06') AS V006,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/07') AS V007,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/08') AS V008,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/09') AS V009,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/10') AS V010,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/11') AS V011,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/12') AS V012,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/13') AS V013,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/14') AS V014,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/15') AS V015,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/16') AS V016,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/17') AS V017,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/18') AS V018,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/19') AS V019,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/20') AS V020,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/21') AS V021,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/22') AS V022,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/23') AS V023,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/24') AS V024,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/25') AS V025,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/26') AS V026,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/27') AS V027,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/28') AS V028,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/29') AS V029,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/30') AS V030,
(SELECT a.Amount FROM copf021 a WHERE a.createdate = @createdate + '/31') AS V031
[劭鵬 在 2005-5-21 11:28 PM 作了最後編輯]
[如果你喜歡本文章,就按本文章之鮮花~送花給作者吧,你的支持就是別人的動力來源]
|
|