Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 19 Apr 2002 @ 12:37:10 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   More SQL Questions and Concerns
 
From:   Tony Howe

Another mystery????

Query #1:

SELECT     B1.AQBICLS, B1.AFVCPRO, ASEIXXX
FROM CPCLMA.QCLMA001 A1,
     (
     SELECT    AQBICLS,AFVCPRO
          FROM      CPCLMB.QCLMB001
          WHERE     ASEIXXX IN ('02024640948','01620099028')
               AND  AFVCPRO IN ('87620','87621','87622') or 0 = 1  ==> added this to force not using index on AFVCPRO
               ) B1
WHERE     A1.AQBICLS=B1.AQBICLS

Results of Query #1: Good results

AQBICLS   AFVCPRO   ASEIXXX
719766317 87622          01620099028
778417390 87622          02024640948

Query #2: removed the "or 0=1"

SELECT  B1.AQBICLS, B1.AFVCPRO, ASEIXXX
FROM CPCLMA.QCLMA001 A1,
     (
     SELECT    AQBICLS,AFVCPRO
          FROM      CPCLMB.QCLMB001
          WHERE     ASEIXXX IN ('02024640948','01620099028')
               AND  AFVCPRO IN ('87620','87621','87622')    ==> now using index on AFVCPRO
               ) B1
WHERE     A1.AQBICLS=B1.AQBICLS

Results of Query #2: Bad results

AQBICLS   AFVCPRO   ASEIXXX
719766317 99214          01620099028
778417390 S0612          02024640948

Thought maybe index was created wrong, so DROPPed and rebuilt, but still get same results??

Thanks, Tony.



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023