开发者

To Get The Date difference

Hi iam having two columns

PR_PurchaseRequestHistory    

1)uid                        
2)POUID                       
3)PRUID                        
4)PRDUID                      
5)CreatedDtTm                  
6)ModifiedDtTM

PO_PurchaseOrderDetails
1)uid   
2)PRUid
3)RespondedDtTm   
4)ModifiedDtTm
5)CreatedDtTm

(unique PRUId) is assigned for every new request and the order is placed POUId for that PRUId.I need to get average date difference for the ID's generated for Particular months

I thinks this makes issue clear Please help me out. I 开发者_开发百科have been struck in this issue for long time


SELECT AVG(HOUR(TIMEDIFF(PO_PurchaseOrderDetails.RespondedDtTm, PR_PurchaseRequestHistory.CreatedDtTm)))
FROM PR_PurchaseRequestHistory
INNER JOIN PO_PurchaseOrderDetails ON PR_PurchaseRequestHistory.PRUID = PO_PurchaseOrderDetails.PRUID
WHERE MONTH(PR_PurchaseRequestHistory.CreatedDtTm) = 3 -- March
AND YEAR(PR_PurchaseRequestHistory.CreatedDtTm) = 2011
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜