mardi 9 août 2016

Where Strange Results

I'm using this query to obtain payments from customer still not payed. So I need to exclude all kind in the where clause. I tryed with <> and != and Not Like but It show me all payment, also with those I've excluded in the where clause. Do you see something that I don't see?

SELECT td= CODCLIFOR,      '', 
            td= DSCCONTO1,      '',  
            td= ANAGRAFICACF.TELEX,      '', 
            td= NUMDOC,      '', 
            td= NUMSCAD,      '', 
            td= CONVERT (VARCHAR(30),DATASCADENZA,105),      '', 
            td= '€ ' + REPLACE(CONVERT(varchar, CAST(IMPORTOSCLIT AS money), 105),',','.') ,       '', 
            td= TIPIEFFETTI.DESCRIZIONE,ESITO
            FROM dbo.TABSCADENZE
            INNER JOIN dbo.ANAGRAFICACF ON CODCLIFOR = CODCONTO
            INNER JOIN dbo.TIPIEFFETTI ON TIPOEFFETTO = EFFETTO
            INNER JOIN dbo.BANCAAPPCF ON CODCLIFOR = BANCAAPPCF.CODCONTO AND BANCAAPPCF.CODICE = TABSCADENZE.BANCAAPPOGGIO
            INNER JOIN  dbo.ANAGRAFICABANCHE ON BANCAINC = CODBANCA
            WHERE  (TABSCADENZE.TIPOEFFETTO NOT LIKE '%2%' OR TABSCADENZE.TIPOEFFETTO NOT LIKE '%10%') AND (TABSCADENZE.ESITO NOT LIKE '%1%' OR  TABSCADENZE.ESITO NOT LIKE '%2%' OR  TABSCADENZE.ESITO NOT LIKE '%4%')  AND  CODCLIFOR LIKE '%C%'
            ORDER BY CODCLIFOR DESC

Thank You!

Aucun commentaire:

Enregistrer un commentaire