| Author | 
		  Message
		 | 
		
		  | bhaski | 
		  
		    
			  
				 Posted: Tue Oct 02, 2007 12:34 pm    Post subject: Help me for Select inside select | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 13 Sep 2006 Posts: 78 Location: USA 
  | 
		  
		    
			  
				Hi friends
 
 
How to use selet query insdie the select query. Like
   
	| Quote: | 
   
  
	|  select a,b, (select a from db1 as somevariable) | 
   
 
 
Not able to submit the full query, due to some issue on this server
 
 
 
Even with / without PASSTHRU I am not able pass this query. 
 
 
 
Thanks and Regards
 
Bhaski. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Tue Oct 02, 2007 2:37 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				You mean:
 
Select a, b from C where a in (Select a from D where x = :y) ? _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhaski | 
		  
		    
			  
				 Posted: Wed Oct 03, 2007 5:42 am    Post subject: Here it is Pls help me | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 13 Sep 2006 Posts: 78 Location: USA 
  | 
		  
		    
			  
				(SELECT RC.RESERVE_TYPE_CODE ,RXC.RESERVE_CATEGORY_CODE,
 
					 PASSTHRU( THE (SELECT ITEM CD.SHORT_CODE FROM Database.{Source2}.{Schema2}.CODES AS CD WHERE CD.CODE_ID = RC.RESERVE_TYPE_CODE)) AS RESTYPECODE , 
 
					PASSTHRU( THE (SELECT ITEM CD.SHORT_CODE FROM Database.{Source2}.{Schema2}.CODES AS CD WHERE CD.CODE_ID = RXC.RESERVE_CATEGORY_CODE)) AS RESCATEGORYCODE
 
 
 
This is the query | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhaski | 
		  
		    
			  
				 Posted: Wed Oct 03, 2007 5:44 am    Post subject: continue... | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 13 Sep 2006 Posts: 78 Location: USA 
  | 
		  
		    
			  
				FROM 
 
					Database.{Source2}.{Schema2}.RESERVE_CURRENT AS RC, 
 
					Database.{Source2}.{Schema2}.RESERVE_X_COVERAGE AS RXC, 
 
					Database.{Source2}.{Schema2}.CLAIM AS C
 
				 WHERE 
 
					RC.RSRV_X_COV_ROW_ID = RXC.RSRV_X_COV_ROW_ID
 
					and RC.CLAIM_ID = C.CLAIM_ID
 
					and C.CLAIM_NUMBER = tempCLNo);
 
 
 
 
Even with / without PASSTHRU I am not able pass this query. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhaski | 
		  
		    
			  
				 Posted: Wed Oct 03, 2007 5:45 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 13 Sep 2006 Posts: 78 Location: USA 
  | 
		  
		    
			  
				MY environment is MQ 6.x.x. WMB is 6.x.x.x DB is SQL 2005. All latest version.
 
 
Pls hlep me to come out from this.
 
 
With Passthru i am getting 
 
 
 
   
	| Quote: | 
   
  
	SQL State ''42000''; Native Error Code '2812'; Error Text ''[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'MED'.''.   
 
 
The error has the following diagnostic information:     SQL State             ''42000''     SQL Native Error Code '2812'     SQL Error Text        ''[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'MED'.'' | 
   
 
 
 
The MED is the output of the second select in the whole select query 
   
	| Quote: | 
   
  
	| (SELECT ITEM CD.SHORT_CODE FROM Database.{Source2}.{Schema2}.CODES AS CD WHERE CD.CODE_ID = RC.RESERVE_TYPE_CODE)) | 
   
 
 
 
Without PASSTHRU
 
 
Implementation error | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhaski | 
		  
		    
			  
				 Posted: Wed Oct 03, 2007 5:46 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 13 Sep 2006 Posts: 78 Location: USA 
  | 
		  
		    
			  
				Hi Friends 
 
I think you can help me now,
 
 
Pls help me to come out
 
 
Thanks and Regards
 
Bhaski. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Wed Oct 03, 2007 6:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Of course, if you are using PASSTHRU you have to use SQL Syntax that is correct for the database you are talking to.
 
 
If you are not using PASSTHRU, you have to use ESQL syntax that is correct. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhaski | 
		  
		    
			  
				 Posted: Wed Oct 03, 2007 10:31 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 13 Sep 2006 Posts: 78 Location: USA 
  | 
		  
		    
			  
				Hi Friends
 
 
It is solved. 
 
 
Thanks and Regards
 
Bhaskar Rajamani. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |