Select Distinct D1.C1 As C1
Total Page:16
File Type:pdf, Size:1020Kb
select distinct D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3,
'0' as c4,
'' as c5,
'' as c6,
1 as c7,
1 as c8,
1 as c9,
D1.c4 as c10 from
(select distinct T73739.CONTACT_ID as c1,
T73739.PROSPECT_ID as c2,
T73739.ACCNT_ID as c3,
T73739.INTEGRATION_ID as c4
from
W_PARTY_PER_D T73739,
W_PARTY_ORG_D T67365,
W_PARTY_D T157680,
W_ORDER_F T84444 /* Fact_W_ORDER_F */
where ( T67365.ROW_WID = T157680.PARTY_ORG_WID and T73739.ROW_WID = T84444.CONTACT_WID and T67365.ACCNT_FLG = 'Y' and T84444.CUSTOMER_WID = T157680.ROW_WID and T67365.INTEGRATION_ID in (select distinct T157680.INTEGRATION_ID as c1
from
W_PARTY_D T157680
where ( T157680.COUNTRY_NAME in ('Germany', 'UK', 'USA', 'United Kingdom', 'Unspecified') ) ) and T73739.INTEGRATION_ID in (select distinct D1.c1 as c1 from
((select T73739.INTEGRATION_ID as c1
from
W_PARTY_PER_D T73739
where ( T73739.SEX_MF_NAME = 'F' )
intersect
select T73739.INTEGRATION_ID as c1
from
W_PARTY_PER_D T73739
where ( T73739.CONTACT_TYPE_NAME = 'Contact' )
intersect
select D1.c1 as c1
from
(select T73739.INTEGRATION_ID as c1,
count(distinct T87231.ROW_WID) as c2
from
W_PARTY_PER_D T73739,
W_RESPONSE_MD T84692 /* Dim_W_RESPONSE_MD */ ,
W_RESPONSE_F T87231 /* Fact_W_RESPONSE_F_PROD */
where ( T73739.ROW_WID = T87231.CONTACT_WID and T84692.ROW_WID = T87231.RESP_ATTR_WID and (T84692.RESP_METHOD in ('Direct mail', 'Email', 'Fax', 'Mail', 'Phone', 'Point of Sale', 'Web')) )
group by T73739.INTEGRATION_ID
) D1)
) D1) )
) D1 order by c1, c2, c3, c10