Advertisement
Advertisement
| 10.03.2008 at 12:58PM PDT, ID: 23786276 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: |
select distinct status.[customer status] as [CUSTOMER STATUS]
, count(*) as [COUNT]
FROM
(
SELECT
distinct pd.orderid as [ORDERID]
, min(pd.customerid) as [CUSTOMEID]
, min(pd.transactiondate) as [MAX PAYMENT DATE]
, min(minorder.[MIN ORDERDATE]) as [MIN ORDERDATE]
, min(pd.transactionresultid) as [TRANSACTIONRESULTID]
, min(itemstatusid) as [ITEMSTATUSID]
, min(pd.itemstatus) as [ITEMSTATUS]
, min(cast(@EndDate as datetime)) as [STATUSDATE]
, (select(case when vic.max_installment >= vic.[TOTAL INSTALLMENT COUNT] then 'COMPLETED'
when(case when MAX(case when pd2.itemstatusid =15 then 'CANCELLED' end) = 'CANCELLED'THEN 'CANCELLED' END ) is null and pd.transactionresultid <>1 then 'DEFAULTED'
when(case when MAX(case when pd2.itemstatusid =15 then 'CANCELLED' end) = 'CANCELLED' THEN 'CANCELLED' END) = 'CANCELLED' then 'CANCELLED'
when(case when MAX(case when pd2.itemstatusid =15 then 'CANCELLED' end) = 'CANCELLED' THEN 'CANCELLED' END) is null
and (pd.transactionresultid) = 1 then 'ACTIVE' else 'N/A' end)
from dbo.view_payment_details_v2 pd2
where pd2.orderid = pd.orderid
and pd2.transactiondate <= @EndDate) as [CUSTOMER STATUS]
FROM dbo.view_payment_details_v2 pd
left outer join bi_reporting.dbo.View_Installment_Counts vic
on vic.orderid = pd.orderid
inner join dbo.view_min_orderdate minorder
on minorder.customerid = pd.customerid
WHERE pd.transactiondate <= (SELECT MAX(i.transactiondate) FROM dbo.view_payment_details_v2 i WHERE i.orderID = pd.orderid and i.transactiondate <= @EndDate )
and minorder.[min orderdate] between @BeginDate and @EndDate
--or pd.transactiondate is null
group by pd.orderid, pd.customerid, transactiondate,pd.itemstatusid,pd.itemstatus, pd.transactionresultid,vic.max_installment, vic.[total installment count]
) status
group by status.[CUSTOMER STATUS]
order by status.[CUSTOMER STATUS]
|