我目前的工作基於存儲在表中最後一個動作日期賬齡分析報告,給出如下表所示:日期帳齡報表+累積式
RequestNo UserCode LastActionDate ActionType
REQ1 407 12/14/2012 9:47 Saved
REQ1 407 12/14/2012 9:48 Submitted
REQ1 407 12/14/2012 9:48 Approved
REQ1 203 12/17/2012 9:54 Reviewed
REQ1 242 12/18/2012 10:29 WF Setup in Dev.
REQ1 203 12/18/2012 15:14 Transport to prod.
REQ1 242 12/18/2012 15:16 Completed
REQ2 407 12/27/2012 10:36 Submitted
REQ2 456 12/27/2012 11:18 Approved
REQ2 407 12/27/2012 11:27 Approved
REQ2 203 12/27/2012 17:34 Reviewed
REQ2 242 12/28/2012 14:07 WF Setup in Dev.
REQ2 203 12/28/2012 14:11 Transport to prod.
REQ2 242 12/28/2012 21:27 Completed
REQ3 407 12/27/2012 11:32 Submitted
REQ3 456 12/27/2012 11:33 Approved
REQ3 407 12/27/2012 11:34 Approved
REQ3 203 12/27/2012 17:33 Reviewed
REQ3 242 12/27/2012 18:33 WF Setup in Dev.
REQ3 203 12/28/2012 13:43 Transport to prod.
REQ3 242 1/3/2013 14:56 Completed
我需要生成具有下列列的老化表 RequestNo,用戶代碼,ReceivedDate,LastActionDate,操作類型,老齡化(差異LastActionDate和ReceivedDate)Cummulative.Just像見下表
RequestNo UserCode ReceivedDate LastActionDate ActionType Aging Cummulative
REQ1 407 12/14/2012 9:47 12/14/2012 9:47 Saved 0 0
REQ1 407 12/14/2012 9:47 12/14/2012 9:48 Submitted 0 0
REQ1 407 12/14/2012 9:48 12/14/2012 9:48 Approved 0 0
REQ1 203 12/14/2012 9:48 12/17/2012 9:54 Reviewed 3 3
REQ1 242 12/17/2012 9:54 12/18/2012 10:29 WF Setup in Dev. 1 4
REQ1 203 12/18/2012 10:29 12/18/2012 15:14 Transport to prod. 0 4
REQ1 242 12/18/2012 15:14 12/18/2012 15:16 Completed 0 4
REQ2 407 12/27/2012 10:36 12/27/2012 10:36 Submitted 0 0
REQ2 456 12/27/2012 10:36 12/27/2012 11:18 Approved 0 0
REQ2 407 12/27/2012 11:18 12/27/2012 11:27 Approved 0 0
REQ2 203 12/27/2012 11:27 12/27/2012 17:34 Reviewed 0 0
REQ2 242 12/27/2012 17:34 12/28/2012 14:07 WF Setup in Dev. 1 1
REQ2 203 12/28/2012 14:07 12/28/2012 14:11 Transport to prod. 0 1
REQ2 242 12/28/2012 14:11 12/28/2012 21:27 Completed 0 1
REQ3 407 12/27/2012 11:32 12/27/2012 11:32 Submitted 0 0
REQ3 456 12/27/2012 11:32 12/27/2012 11:33 Approved 0 0
REQ3 407 12/27/2012 11:33 12/27/2012 11:34 Approved 0 0
REQ3 203 12/27/2012 11:34 12/27/2012 17:33 Reviewed 0 0
REQ3 242 12/27/2012 17:33 12/27/2012 18:33 WF Setup in Dev. 0 0
REQ3 203 12/27/2012 18:33 12/28/2012 13:43 Transport to prod. 1 1
REQ3 242 12/28/2012 13:43 1/3/2013 14:56 Completed 6 7
哪裏'ReceivedDate'從何而來? 「Cummulative」是什麼意思?如果你指出你正在使用什麼樣的RDBMS(SQL * flavor *),你也許會想要添加你自己的腳本嘗試(即使它們不成功)。 –
什麼是RDBMS(SQL Server,MySql,Oracle,.. 。)你使用的是嗎? – peterm