Why this query doesn't work ?



IBM's flagship relational database management system

Why this query doesn't work ?

Postby vegafacundodaniel » Wed Jun 04, 2014 5:38 pm

Hello everybody !
could anyone help me, please ?

Why this query doesn't work ?

  SELECT * FROM                                             
 (SELECT A.nro AS nro1, A.matric AS matric1,                     
  B.city, D.country                           
  FROM TB01 A, TB02 B, TB03 C,  TB04 D   
  WHERE A.nro = B.nro AND                                     
        B.temo1 = C.code AND                                     
        C.nro = D.nro AND                                     
        A.type = '022' AND C.nomen = 'A1') T1,                   
 (SELECT E.nro AS nro2, E.matric AS matric2,                     
  F.city, H.country                               
  FROM TB01 E, TB02 F, TB03 G,  TB04 H   
  WHERE E.nro = F.nro AND                                     
        F.temo2 = G.code AND                                     
        G.nro = H.nro AND                                     
        E.type = '022' AND G.nomen = 'A2') T2                   
    WHERE T1.nro1 = T2.nro2 AND                                 
      AND T1.matric1 = T2.matric2;


I get this error on the WHERE condition:
------------------------------------------------

DSNT408I SQLCODE = -104, ERROR:  ILLEGAL SYMBOL "T1". SOME SYMBOLS THAT MIGHT   
         BE LEGAL ARE: ( . AT MICROSECONDS MICROSECOND SECONDS SECOND MINUTES   
         MINUTE                                                                 
DSNT418I SQLSTATE   = 42601 SQLSTATE RETURN CODE                               
DSNT415I SQLERRP    = DSNHPARS SQL PROCEDURE DETECTING ERROR                   
DSNT416I SQLERRD    = 3 0  0  -1  1161  502 SQL DIAGNOSTIC INFORMATION         
DSNT416I SQLERRD    = X'00000003'  X'00000000'  X'00000000'  X'FFFFFFFF'       
         X'00000489'  X'000001F6' SQL DIAGNOSTIC INFORMATION           


Thanks in advance!

Code'd
vegafacundodaniel
 
Posts: 61
Joined: Tue Jul 20, 2010 4:27 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Why this query doesn't work ?

 

Re: Why this query doesn't work ?

Postby Gandosio » Thu Jun 12, 2014 2:28 pm

use AS T1.
Gandosio
 
Posts: 12
Joined: Tue Dec 21, 2010 3:47 pm
Has thanked: 0 time
Been thanked: 2 times

Re: Why this query doesn't work ?

Postby vegafacundodaniel » Tue Jun 17, 2014 4:42 pm

Hello,

it doesn't work with "AS T1"

thanks for any help
vegafacundodaniel
 
Posts: 61
Joined: Tue Jul 20, 2010 4:27 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Why this query doesn't work ?

Postby Gandosio » Tue Jun 17, 2014 6:43 pm

have two and in the where clause

E.type = '022' AND G.nomen = 'A2') T2
WHERE T1.nro1 = T2.nro2 AND
AND T1.matric1 = T2.matric2;
Gandosio
 
Posts: 12
Joined: Tue Dec 21, 2010 3:47 pm
Has thanked: 0 time
Been thanked: 2 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post