|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  ESQL- SELECT Query from Multiple Database Tables | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | sandman147 | 
		  
		    
			  
				 Posted: Tue Mar 25, 2014 6:51 am    Post subject: ESQL- SELECT Query from Multiple Database Tables | 
				     | 
			   
			 
		   | 
		 
		
		   Apprentice
 
 Joined: 01 Sep 2013 Posts: 42
  
  | 
		  
		    
			  
				Implementing the following Query in WMB ESQL
 
 
   
	| Code: | 
   
  
	                     SELECT A.SOURCE_ID,                                      
 
                            A.FOR_ID,                                        
 
                            A.TRACE_NBR,                                
 
                            A.SEQUENCE_ID,                                    
 
                            A.CLIENT_ID,                             
 
                            A.USER_ID,                             
 
                            A.INVENTORY_DATE,                                   
 
                            B.RT_DESCRIPTION,                                       
 
                            A.RT_INVENTORY_NBR,                                   
 
                            B.RT_INVENTORY_GROSS,                               
 
                            B.RT_DISCOUNT_PERC,                                   
 
                                B.RT_INVENTORY_NET,                                                                      B.GEN_NAME,                                                                                              B.GEN_ADDR,                                                                 
 
                            B.GEN_CITY,                                   
 
                            B.GEN_STATE,                                  
 
                            B.GEN_ZIP,                                    
 
                            B.GEN_COUNTRY,                                
 
                            B.INVENTORY_LOC,                                    
 
                            B.RT_INVENTORY_AMOUNT_PAID                                
 
                                                                              
 
                     FROM REMIT A, CHK_REMIT B                          
 
                                                                              
 
                     WHERE A.SOURCE_ID     = B.SOURCE_ID                    
 
                       AND A.FOR_ID              = B.FOR_ID                      
 
                       AND A.TRACE_NBR       = B.TRACE_NBR              
 
                       AND A.SEQUENCE_ID    = B.SEQUENCE_ID                  
 
                       AND A.SOURCE_ID       = PY-SOURCE-ID                  
 
                       AND A.FOR_ID             = PY-FOR-ID                    
 
                       AND A.TRACE_NBR       = PY-TRACE-NBR       | 
   
 
      
 
 
Note: 'PY-SOURCE-ID', 'PY-FOR-ID', 'PY-TRACE-NBR' belong to PAYEE table | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Tue Mar 25, 2014 10:14 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				And was there a question here?
 
I don't see Payee appearing in any from clause... ..., and please next time surround your code with the "code" tags. 
 
Have fun    _________________ MQ & Broker admin | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | sandman147 | 
		  
		    
			  
				 Posted: Tue Mar 25, 2014 10:46 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Apprentice
 
 Joined: 01 Sep 2013 Posts: 42
  
  | 
		  
		    
			  
				| When attempting to run the above SELECT statement against a test database, the query wont return any values and errors out. How is the code  to be modified so it may execute. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | Tibor | 
		  
		    
			  
				 Posted: Wed Mar 26, 2014 1:01 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand Master
 
 Joined: 20 May 2001 Posts: 1033 Location: Hungary 
  | 
		  
		    
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | Rix | 
		  
		    
			  
				 Posted: Tue Apr 01, 2014 2:29 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Newbie
 
 Joined: 01 Apr 2014 Posts: 3
  
  | 
		  
		    
			  
				Normally I would be thinking that references to the manual is like kicking a downed man, but Tibor is right. So many things are wrong....
 
 
# How do you define the source database?
 
# You need brackets after the table names... they are lists.... | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | gunjand | 
		  
		    
			  
				 Posted: Tue Apr 01, 2014 3:13 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Novice
 
 Joined: 21 May 2009 Posts: 23
  
  | 
		  
		    
			  
				Do you want to pass the payee information dynamically or you want to handle the null return?   | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | 
		    
		   | 
		 
	   
	 | 
   
 
  
	     | 
	 | 
	Page 1 of 1 | 
   
 
 
 
  
  	
	  
		
		  
 
  | 
		  You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |