Hello,
I have written this query, unfortunately Sybase doesnt allow me to execute it (a maximum of 1 subquery predicate per conjunct is supported in this release...which is the latest one)
Maybe it's solvable by using UNION and repeating the query for each exists, but then I will have a problem with the count as I will receive 6 counts for the same DBA.dim_action.action_group_descr
Anyone has an idea how to solve this ?
The query :
-----------
SELECT
DBA.dim_action.action_group_descr,
count (distinct R.ind_key)
FROM
DBA.dim_individual,
DBA.fac_ind_reaction R,
DBA.dim_action,
DBA.dim_email
WHERE
DBA.dim_individual.ind_key=R.ind_key
AND R.action_key=DBA.dim_action.action_key
AND R.email_key=DBA.dim_email.email_key
AND DBA.dim_action.action_type = 'SOU'
AND DBA.dim_action.channel IN ('Online', 'Both', 'Offline')
AND DBA.dim_email.email_status = 'OK'
AND DBA.dim_individual.household_status = 'OK'
AND
(EXISTS (SELECT 1 from DBA.fac_brand_usage A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_category_usage B
WHERE B.ind_key = R.ind_key
AND B.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_profiles A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_life_trait A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_appliance A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_question A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key) )
GROUP BY
DBA.dim_action.action_group_descr
I have written this query, unfortunately Sybase doesnt allow me to execute it (a maximum of 1 subquery predicate per conjunct is supported in this release...which is the latest one)
Maybe it's solvable by using UNION and repeating the query for each exists, but then I will have a problem with the count as I will receive 6 counts for the same DBA.dim_action.action_group_descr
Anyone has an idea how to solve this ?
The query :
-----------
SELECT
DBA.dim_action.action_group_descr,
count (distinct R.ind_key)
FROM
DBA.dim_individual,
DBA.fac_ind_reaction R,
DBA.dim_action,
DBA.dim_email
WHERE
DBA.dim_individual.ind_key=R.ind_key
AND R.action_key=DBA.dim_action.action_key
AND R.email_key=DBA.dim_email.email_key
AND DBA.dim_action.action_type = 'SOU'
AND DBA.dim_action.channel IN ('Online', 'Both', 'Offline')
AND DBA.dim_email.email_status = 'OK'
AND DBA.dim_individual.household_status = 'OK'
AND
(EXISTS (SELECT 1 from DBA.fac_brand_usage A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_category_usage B
WHERE B.ind_key = R.ind_key
AND B.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_profiles A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_life_trait A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_appliance A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key)
OR EXISTS (SELECT 1 from DBA.fac_question A
WHERE A.ind_key = R.ind_key
AND A.action_key = R.action_key) )
GROUP BY
DBA.dim_action.action_group_descr