Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
shubhada
Posting Yak Master
117 Posts |
Posted - 2006-07-12 : 01:16:56
|
| I have one table with following dataID1 ID2 Amt LineNo Date03280601 27691 50.0000 1 2006-01-15 00:00:0003280601 27691 1000.0000 2 2006-01-15 00:00:0003280601 27691 100.0000 3 2006-03-15 00:00:0003280601 27691 100.0000 4 2006-03-30 00:00:00as per the requirement data should display in report like ID1 ID2 TotalAmt AddPayAmt 03280601 27691 1250.0000 200.0000here where clause will pass by vc++ codewhere Date between '2006-03-01 00:00:00' and '2006-03-31 00:00:00'for this I have created one view alter view vcmAddVarPayAmtasselect PaymentsDetail. ID1, PaymentsDetail.ID2, sum(PaymentsDetail.Amt) AddPayAmt, vcmPaymentHistorySummary.PaymntAmt,from PaymentsDetail join vcmPaymentHistorySummary on PaymentsDetail.ID1 = vcmPaymentHistorySummary.ID1 and PaymentsDetail.ID2 = vcmPaymentHistorySummary.ID2 group by PaymentsDetail.ClaimID, PaymentsDetail.EventID,vcmPaymentHistorySummary.PaymntAmt so o/p of this view is ID1 ID2 AddPayAmt Amt -------------------- -------------- --------------------- --------------------- 03280601 27691 1250.0000 1250.0000 here Amt is correct .I am taking from some other view but AddPayAmt is wrong (it should be 200,sum of last 2 record ) because it is depend on date range and that date range is pass by vc++ code..so please tell me how I can find out the AddPayAmt |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-07-12 : 02:05:08
|
| Did you use this?Select * from vcmAddVarPayAmtwhere Date between '2006-03-01 00:00:00' and '2006-03-31 00:00:00'MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|