Mara's dad Yes I can ! | J'ai pas la solution mais :
( J'ai remplacé les @prompt par les valeurs pour faire plus lisible )
Déja, y'a un regroupement de AND qui ne sert à rien :
Code :
- SELECT
- MAP_SALES_AREA.SALES_ORG_CODE,
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE,
- count( distinct TDS_INVOICE_LINE.INVOICE_NUMBER )
- FROM
- MAP_SALES_AREA,
- MAP_DOCUMENT_TYPE,
- TDS_INVOICE_LINE
- WHERE
- ( MAP_DOCUMENT_TYPE.END_DATE = '31/12/4712' )
- AND ( MAP_DOCUMENT_TYPE.BE_ID=TDS_INVOICE_LINE.DOC_CATEG_TYPE )
- AND ( MAP_SALES_AREA.BE_ID=TDS_INVOICE_LINE.SALES_AREA )
- AND ( MAP_SALES_AREA.END_DATE = '31/12/4712' )
- AND ( MAP_SALES_AREA.DIST_CHANNEL_CODE<> '20' )
- AND // <- Ce regroupement de AND ne sert à rien !
- (
- (
- MAP_SALES_AREA.SALES_ORG_CODE IN ('1158')
- OR '%' IN ('1158')
- )
- AND
- (
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE IN ('YFDI')
- OR '%' IN ('YFDI')
- )
- AND MAP_DOCUMENT_TYPE.DOC_TYPE_CODE IN ('YF02', 'YFAV', 'YFIC', 'YFMS', 'YFNT', 'YIV1', 'YFMA')
- )
- GROUP BY
- MAP_SALES_AREA.SALES_ORG_CODE,
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE
|
Donc çà devient :
La requête qui merde
Code :
- SELECT
- MAP_SALES_AREA.SALES_ORG_CODE,
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE,
- count( distinct TDS_INVOICE_LINE.INVOICE_NUMBER )
- FROM
- MAP_SALES_AREA,
- MAP_DOCUMENT_TYPE,
- TDS_INVOICE_LINE
- WHERE
- ( MAP_DOCUMENT_TYPE.END_DATE = '31/12/4712' )
- AND ( MAP_DOCUMENT_TYPE.BE_ID=TDS_INVOICE_LINE.DOC_CATEG_TYPE )
- AND ( MAP_SALES_AREA.BE_ID=TDS_INVOICE_LINE.SALES_AREA )
- AND ( MAP_SALES_AREA.END_DATE = '31/12/4712' )
- AND ( MAP_SALES_AREA.DIST_CHANNEL_CODE<> '20' )
- AND
- (
- MAP_SALES_AREA.SALES_ORG_CODE IN ('1158')
- OR '%' IN ('1158')
- )
- AND
- (
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE IN ('YFDI')
- OR '%' IN ('YFDI')
- )
- AND MAP_DOCUMENT_TYPE.DOC_TYPE_CODE IN ('YF02', 'YFAV', 'YFIC', 'YFMS', 'YFNT', 'YIV1', 'YFMA')
- GROUP BY
- MAP_SALES_AREA.SALES_ORG_CODE,
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE
|
La requête qui marche
Code :
- SELECT
- MAP_SALES_AREA.SALES_ORG_CODE,
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE,
- count( distinct TDS_INVOICE_LINE.INVOICE_NUMBER )
- FROM
- MAP_SALES_AREA,
- MAP_DOCUMENT_TYPE,
- TDS_INVOICE_LINE
- WHERE
- ( MAP_DOCUMENT_TYPE.END_DATE = '31/12/4712' )
- AND ( MAP_DOCUMENT_TYPE.BE_ID=TDS_INVOICE_LINE.DOC_CATEG_TYPE )
- AND ( MAP_SALES_AREA.BE_ID=TDS_INVOICE_LINE.SALES_AREA )
- AND ( MAP_SALES_AREA.END_DATE = '31/12/4712' )
- AND ( MAP_SALES_AREA.DIST_CHANNEL_CODE<> '20' )
- AND
- (
- MAP_SALES_AREA.SALES_ORG_CODE IN ('1158')
- OR '%' IN ('1158')
- )
- AND MAP_DOCUMENT_TYPE.DOC_TYPE_CODE IN ('YF02', 'YFAV', 'YFIC', 'YFMS', 'YFNT', 'YIV1', 'YFMA')
- AND
- (
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE IN ('YFDI')
- OR '%' IN ('YFDI')
- )
- GROUP BY
- MAP_SALES_AREA.SALES_ORG_CODE,
- MAP_DOCUMENT_TYPE.DOC_TYPE_CODE
|
Essaye comme çà directement dans ton SGBD (sans passer par BO) pour voir ce que çà donne.
C'est peut-être BO qui essaye d'optimiser la requête et qui se prend les pieds dans le tapis Message édité par Mara's dad le 24-10-2003 à 12:58:39 ---------------
Laissez l'Etat dans les toilettes où vous l'avez trouvé.
|