Home » U++ Library support » U++ SQL » SQL EXPR NOT WORKING 
	
		
		
			| SQL EXPR NOT WORKING [message #58178] | 
			Tue, 08 March 2022 16:02   | 
		 
		
			
				
				
				
					
						  
						reign_of_terror
						 Messages: 6 Registered: October 2021 
						
					 | 
					Promising Member  | 
					 | 
		 
		 
	 | 
 
	
		Hi all- 
 
SQL * Select(DEPT_NO) 
     .From(EMPLOYEE) 
     .LeftJoin(Select(DEPT_NO).From(DEPT)) 
     .On(DEPT_NO.Of(EMPLOYEE) == DEPT_NO.Of(DEPT)); 
     while(SQL.Fetch()){	 
	PromptOK("FOO"); 
	  // list.Add(SQL[ID]); 
	    } 
 
It should give a message "foo" but it doesn't. It is compiling okay. 
 
They are both listed in sqlexpr postgresql examples side by side in the UPP documentation: 
 
select EMPLOYEE.DEPT_NO 
 
from EMPLOYEE left outer join 
 
(select DEPT_NO from DEPT) AS DEPT 
ON EMPLOYEE.DEPT_NO = DEPT.DEPT_NO 
 
This works in postgresql... 
 
Here is my schema: 
 
 TABLE_ (EMPLOYEE) 
 SERIAL (ID) PRIMARY_KEY  
 STRING_ (EMP_NAME, 100) 
 STRING (DEPT_NO, 10)  
 END_TABLE  
 
TABLE_ (DEPT) 
 STRING_ (DEPT_NO, 10) PRIMARY_KEY 
 STRING_ (DEPT_NAME, 100) 
 STRING_ (DEPT_LOCATION, 100) 
 END_TABLE 
 
Any idea as to why it isn't working?  Sorry to bother you guys! 
 
reign_of_terror  
 
thanks 
 
	   
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: SQL EXPR NOT WORKING ...OOPS YES IT IS [message #58179 is a reply to message #58178] | 
			Wed, 09 March 2022 04:35   | 
		 
		
			
				
				
				
					
						  
						reign_of_terror
						 Messages: 6 Registered: October 2021 
						
					 | 
					Promising Member  | 
					 | 
		 
		 
	 | 
 
	
		Hi guys- 
 
I got it to work this time. 
 
I think I had settings a little off. It was strange that some of the sql 
worked and some didn't. That is why I got paranoid that something on 
UPP end wasn't working. The thing that helped me was the logfile which 
I never looked at until today. I think it was complaining about ambiguous 
ID amongst whatever else.  
 
I decided to give it another look after listening to some crickets. 
 
Sorry all   
 
below works... 
 
SQL * Select(ID.Of(EMPLOYEE), CNAME.Of(CONTACT), DEPTNO.Of(DEPT)) 
     .From(EMPLOYEE) 
     .LeftJoin(CONTACT) 
     .On(ID.Of(EMPLOYEE) == fk_emp_id.Of(CONTACT)) 
     .LeftJoin(DEPT) 
     .On(DEPTNO.Of(EMPLOYEE) == DEPTNO.Of(DEPT)); 
     while(SQL.Fetch()){	 
	//PromptOK("foo"); 
	  list.Add(SQL[ID],SQL[CNAME], SQL[DEPTNO]); 
	    }
		
		
		[Updated on: Wed, 09 March 2022 04:40] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 14:29:24 CET 2025 
 Total time taken to generate the page: 0.05064 seconds 
 |