cristina10
Programmer
I make a rapport but it takes a lot of time and I make a other sql and it take less time
The old sql is
(
SELECT
INFOBLEU.ACTIVI.BANQ_BCF,
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
INFOBLEU.ACTIVI.INTER_INTRA,
sum(INFOBLEU.ACTIVI.MNT_EURO),
sum(INFOBLEU.ACTIVI.NBR_TC),
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
FROM
INFOBLEU.ACTIVI,
INFOBLEU.TYPE_CARTE
WHERE
( INFOBLEU.TYPE_CARTE.IDF_TYPE_CARTE=INFOBLEU.ACTIVI.IDF_TYPE_CARTE
AND INFOBLEU.TYPE_CARTE.IDF_RESEAU in ('1','2') )
AND (
INFOBLEU.ACTIVI.DAT_TRAITEMENT BETWEEN @variable('Date de début?') AND @variable('Date de fin?')
AND INFOBLEU.ACTIVI.SENS_ACTIVITE = @variable('Sens (I/O) ?')
AND INFOBLEU.ACTIVI.USAGE = '1'
AND INFOBLEU.ACTIVI.COD_TRANSACTION IN ('05', '06', '07', '15', '16', '17', '25', '26', '27', '35', '36', '37')
)
GROUP BY
INFOBLEU.ACTIVI.BANQ_BCF,
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
INFOBLEU.ACTIVI.INTER_INTRA,
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
UNION
(
SELECT
INFOBLEU.ACTIVI.BANQ_BCF,
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
'TR',
sum(INFOBLEU.ACTIVI.MNT_EURO),
sum(INFOBLEU.ACTIVI.NBR_TC),
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
FROM
INFOBLEU.ACTIVI,
INFOBLEU.TYPE_CARTE
WHERE
( INFOBLEU.TYPE_CARTE.IDF_TYPE_CARTE=INFOBLEU.ACTIVI.IDF_TYPE_CARTE
AND INFOBLEU.TYPE_CARTE.IDF_RESEAU in ('1','2') )
AND (
INFOBLEU.ACTIVI.DAT_TRAITEMENT BETWEEN @variable('Date de début?') AND @variable('Date de fin?')
AND INFOBLEU.ACTIVI.SENS_ACTIVITE = @variable('Sens (I/O) ?')
AND INFOBLEU.ACTIVI.USAGE = '1'
AND INFOBLEU.ACTIVI.COD_TRANSACTION IN ('05', '06', '07', '15', '16', '17', '25', '26', '27', '35', '36', '37')
)
GROUP BY
INFOBLEU.ACTIVI.BANQ_BCF,
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
'TR',
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
UNION
(
SELECT
'TB',
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
INFOBLEU.ACTIVI.INTER_INTRA,
sum(INFOBLEU.ACTIVI.MNT_EURO),
sum(INFOBLEU.ACTIVI.NBR_TC),
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
FROM
INFOBLEU.ACTIVI,
INFOBLEU.TYPE_CARTE
WHERE
( INFOBLEU.TYPE_CARTE.IDF_TYPE_CARTE=INFOBLEU.ACTIVI.IDF_TYPE_CARTE
AND INFOBLEU.TYPE_CARTE.IDF_RESEAU in ('1','2') )
AND (
INFOBLEU.ACTIVI.DAT_TRAITEMENT BETWEEN @variable('Date de début?') AND @variable('Date de fin?')
AND INFOBLEU.ACTIVI.USAGE = '1'
AND INFOBLEU.ACTIVI.SENS_ACTIVITE = @variable('Sens (I/O) ?')
AND INFOBLEU.ACTIVI.COD_TRANSACTION IN ('05', '06', '07', '15', '16', '17', '25', '26', '27', '35', '36', '37')
)
GROUP BY
'TB',
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
INFOBLEU.ACTIVI.INTER_INTRA,
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
UNION
SELECT
'TB',
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
'TR',
sum(INFOBLEU.ACTIVI.MNT_EURO),
sum(INFOBLEU.ACTIVI.NBR_TC),
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
FROM
INFOBLEU.ACTIVI,
INFOBLEU.TYPE_CARTE
WHERE
( INFOBLEU.TYPE_CARTE.IDF_TYPE_CARTE=INFOBLEU.ACTIVI.IDF_TYPE_CARTE
AND INFOBLEU.TYPE_CARTE.IDF_RESEAU in ('1','2') )
AND (
INFOBLEU.ACTIVI.COD_TRANSACTION IN ('05', '06', '07', '15', '16', '17', '25', '26', '27', '35', '36', '37')
AND INFOBLEU.ACTIVI.DAT_TRAITEMENT BETWEEN @variable('Date de début?') AND @variable('Date de fin?')
AND INFOBLEU.ACTIVI.SENS_ACTIVITE = @variable('Sens (I/O) ?')
AND INFOBLEU.ACTIVI.USAGE = '1'
)
GROUP BY
'TB',
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
'TR',
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
)
)
)
and the new sql is
SELECT DECODE(GROUPING(infobleu.activi_m.banq_bcf),1,'TTEBQE', infobleu.activi_m.banq_bcf) banq_bcf,
infobleu.activi_m.cod_mcc,
infobleu.activi_m.idf_type_carte, infobleu.activi_m.sens_activite,
infobleu.activi_m.usage, infobleu.activi_m.usage_ardef,
DECODE(GROUPING(infobleu.activi_m.inter_intra),1,'TTEREGION', infobleu.activi_m.inter_intra) inter_intra,
sum(infobleu.activi_m.mnt_euro), sum(
infobleu.activi_m.nbr_tc), infobleu.type_carte.lib_type_carte
FROM infobleu.activi_m, infobleu.type_carte
WHERE infobleu.type_carte.idf_type_carte = infobleu.activi_m.idf_type_carte
AND infobleu.type_carte.idf_reseau IN ('1', '2')
AND infobleu.activi_m.mois_traitement BETWEEN '01/10/2006' AND
'01/12/2006'
AND infobleu.activi_m.sens_activite = 'I'
AND infobleu.activi_m.usage = '1'
AND infobleu.activi_m.cod_transaction IN ('05', '06', '07', '15', '16',
'17', '25', '26', '27', '35', '36', '37')
GROUP BY rollup(infobleu.activi_m.banq_bcf),
infobleu.activi_m.cod_mcc,
infobleu.activi_m.idf_type_carte, infobleu.activi_m.sens_activite,
infobleu.activi_m.usage, infobleu.activi_m.usage_ardef,
rollup(infobleu.activi_m.inter_intra), infobleu.type_carte.lib_type_carte
But I don't now how I can make the grouping and rollup in BO
Help me please
Thanks
The old sql is
(
SELECT
INFOBLEU.ACTIVI.BANQ_BCF,
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
INFOBLEU.ACTIVI.INTER_INTRA,
sum(INFOBLEU.ACTIVI.MNT_EURO),
sum(INFOBLEU.ACTIVI.NBR_TC),
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
FROM
INFOBLEU.ACTIVI,
INFOBLEU.TYPE_CARTE
WHERE
( INFOBLEU.TYPE_CARTE.IDF_TYPE_CARTE=INFOBLEU.ACTIVI.IDF_TYPE_CARTE
AND INFOBLEU.TYPE_CARTE.IDF_RESEAU in ('1','2') )
AND (
INFOBLEU.ACTIVI.DAT_TRAITEMENT BETWEEN @variable('Date de début?') AND @variable('Date de fin?')
AND INFOBLEU.ACTIVI.SENS_ACTIVITE = @variable('Sens (I/O) ?')
AND INFOBLEU.ACTIVI.USAGE = '1'
AND INFOBLEU.ACTIVI.COD_TRANSACTION IN ('05', '06', '07', '15', '16', '17', '25', '26', '27', '35', '36', '37')
)
GROUP BY
INFOBLEU.ACTIVI.BANQ_BCF,
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
INFOBLEU.ACTIVI.INTER_INTRA,
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
UNION
(
SELECT
INFOBLEU.ACTIVI.BANQ_BCF,
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
'TR',
sum(INFOBLEU.ACTIVI.MNT_EURO),
sum(INFOBLEU.ACTIVI.NBR_TC),
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
FROM
INFOBLEU.ACTIVI,
INFOBLEU.TYPE_CARTE
WHERE
( INFOBLEU.TYPE_CARTE.IDF_TYPE_CARTE=INFOBLEU.ACTIVI.IDF_TYPE_CARTE
AND INFOBLEU.TYPE_CARTE.IDF_RESEAU in ('1','2') )
AND (
INFOBLEU.ACTIVI.DAT_TRAITEMENT BETWEEN @variable('Date de début?') AND @variable('Date de fin?')
AND INFOBLEU.ACTIVI.SENS_ACTIVITE = @variable('Sens (I/O) ?')
AND INFOBLEU.ACTIVI.USAGE = '1'
AND INFOBLEU.ACTIVI.COD_TRANSACTION IN ('05', '06', '07', '15', '16', '17', '25', '26', '27', '35', '36', '37')
)
GROUP BY
INFOBLEU.ACTIVI.BANQ_BCF,
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
'TR',
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
UNION
(
SELECT
'TB',
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
INFOBLEU.ACTIVI.INTER_INTRA,
sum(INFOBLEU.ACTIVI.MNT_EURO),
sum(INFOBLEU.ACTIVI.NBR_TC),
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
FROM
INFOBLEU.ACTIVI,
INFOBLEU.TYPE_CARTE
WHERE
( INFOBLEU.TYPE_CARTE.IDF_TYPE_CARTE=INFOBLEU.ACTIVI.IDF_TYPE_CARTE
AND INFOBLEU.TYPE_CARTE.IDF_RESEAU in ('1','2') )
AND (
INFOBLEU.ACTIVI.DAT_TRAITEMENT BETWEEN @variable('Date de début?') AND @variable('Date de fin?')
AND INFOBLEU.ACTIVI.USAGE = '1'
AND INFOBLEU.ACTIVI.SENS_ACTIVITE = @variable('Sens (I/O) ?')
AND INFOBLEU.ACTIVI.COD_TRANSACTION IN ('05', '06', '07', '15', '16', '17', '25', '26', '27', '35', '36', '37')
)
GROUP BY
'TB',
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
INFOBLEU.ACTIVI.INTER_INTRA,
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
UNION
SELECT
'TB',
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
'TR',
sum(INFOBLEU.ACTIVI.MNT_EURO),
sum(INFOBLEU.ACTIVI.NBR_TC),
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
FROM
INFOBLEU.ACTIVI,
INFOBLEU.TYPE_CARTE
WHERE
( INFOBLEU.TYPE_CARTE.IDF_TYPE_CARTE=INFOBLEU.ACTIVI.IDF_TYPE_CARTE
AND INFOBLEU.TYPE_CARTE.IDF_RESEAU in ('1','2') )
AND (
INFOBLEU.ACTIVI.COD_TRANSACTION IN ('05', '06', '07', '15', '16', '17', '25', '26', '27', '35', '36', '37')
AND INFOBLEU.ACTIVI.DAT_TRAITEMENT BETWEEN @variable('Date de début?') AND @variable('Date de fin?')
AND INFOBLEU.ACTIVI.SENS_ACTIVITE = @variable('Sens (I/O) ?')
AND INFOBLEU.ACTIVI.USAGE = '1'
)
GROUP BY
'TB',
INFOBLEU.ACTIVI.COD_MCC,
INFOBLEU.ACTIVI.IDF_TYPE_CARTE,
INFOBLEU.ACTIVI.SENS_ACTIVITE,
INFOBLEU.ACTIVI.USAGE,
INFOBLEU.ACTIVI.USAGE_ARDEF,
'TR',
INFOBLEU.TYPE_CARTE.LIB_TYPE_CARTE
)
)
)
and the new sql is
SELECT DECODE(GROUPING(infobleu.activi_m.banq_bcf),1,'TTEBQE', infobleu.activi_m.banq_bcf) banq_bcf,
infobleu.activi_m.cod_mcc,
infobleu.activi_m.idf_type_carte, infobleu.activi_m.sens_activite,
infobleu.activi_m.usage, infobleu.activi_m.usage_ardef,
DECODE(GROUPING(infobleu.activi_m.inter_intra),1,'TTEREGION', infobleu.activi_m.inter_intra) inter_intra,
sum(infobleu.activi_m.mnt_euro), sum(
infobleu.activi_m.nbr_tc), infobleu.type_carte.lib_type_carte
FROM infobleu.activi_m, infobleu.type_carte
WHERE infobleu.type_carte.idf_type_carte = infobleu.activi_m.idf_type_carte
AND infobleu.type_carte.idf_reseau IN ('1', '2')
AND infobleu.activi_m.mois_traitement BETWEEN '01/10/2006' AND
'01/12/2006'
AND infobleu.activi_m.sens_activite = 'I'
AND infobleu.activi_m.usage = '1'
AND infobleu.activi_m.cod_transaction IN ('05', '06', '07', '15', '16',
'17', '25', '26', '27', '35', '36', '37')
GROUP BY rollup(infobleu.activi_m.banq_bcf),
infobleu.activi_m.cod_mcc,
infobleu.activi_m.idf_type_carte, infobleu.activi_m.sens_activite,
infobleu.activi_m.usage, infobleu.activi_m.usage_ardef,
rollup(infobleu.activi_m.inter_intra), infobleu.type_carte.lib_type_carte
But I don't now how I can make the grouping and rollup in BO
Help me please
Thanks