Monday, November 17, 2025

Select statements

 ===Select Satements=== 

===crossCompany== 

Static Void Con_CrossCompany(Args _args) 

{ 

CustTable custTable; 

Container Companies=['IBM','HCL'] 

while Select CrossCompany:Companies * from custTable 

{ 

info(custTable.Accountnum); 

} 

} 

 

Static Void CrossCompany(Args _args) 

{ 

 

CustTable custTable; 

Container Compaines=['TATA','TCS']; 

while Select Crosscompany:compaines * from custTable 

{ 

info(custTable.Accountnum); 

} 

} 

==FirstFast== 

 Static Void Firstfast(Args _args) 

{ 

CustTable custTable; 

Whele select firstFast * from custTable 

{ 

info(custTable.Accountnum); 

} 

 

Static Void FirstFast(Args _args) 

{ 

CustTable custTable; 

while select Firstfast custTable 

{ 

info(custTable.Accountnum) 

} 

} 

 

==FirstOnly=== 

 

Static Void CustTable(Args _args) 

{ 

CustTable custTable; 

while select FirstOnly custTable 

{ 

info(custTable.accountnum); 

} 

} 

=====ForUpdate==== 

Static void Forupdate(Args _args) 

{ 

Con_Calc con_Calc; 

ttsbegin; 

While select forUpdate con_Calc where con_Calc.name="Shiva" 

{ 

con_Calc.Name="Shiva Ch"; 

con_Calc.update(); 

} 

ttscommit; 

 

==where == 

Select void Where(Args _args) 

{ 

CustTable custTable; 

while Select * from custTable where custTable.custGroup="10" 

{ 

info(strfmt("%1---%2",custTable.custGroup,CustTable.Acccountnum); 

 

} 

 

===Groupby=== 

 

Static Void Groupby(Args _args) 

{ 

 

custTable custTable; 

while select minof(AmountMST) from custTable group by Accountnum 

{ 

info(strfmt("%1---%2",custTable.Accountnum,custTable.AmountMST); 

} 

} 

 

===Count=== 

 

Static Void Count(Args _args) 

{ 

CustTable custTable; 

int a=0; 

 while select count(rectid) from custTable 

{ 

a=custTable.RectId; 

 

} 

info(strfmt("%1",a)); 

} 

 

===ChangeCompany=== 

 

Static void ChangeCompany(Args _args) 

{ 

CustTable custTable; 

info(custTable.dataAreaId); 

changeCompany('IBM'); 

{ 

custTable=null; 

while select custTable 

{ 

info(strfmt("%1", custTable.dataAreaId); 

} 

} 

===Relational Operator=== 

Static Void RelationalOper(Args _args) 

{ 

CustTable custTable; 

while select custTable where custTable.accounnum="OU_04"&& custTable.Accountnum="OU-10" 

{ 

info(strfmt("%1",custTable.Accountnum)); 

} 

} 

Static Void RelationalOper(Args _args) 

{ 

custTable custTable; 

while select custTable where custTable.Accountnum="OU_04"||custTable.Accountnum="OU-05"; 

{ 

info(strfmt("%1",custTable.accountnum)); 

} 

} 

 

===Joins=== 

--Inner Join-- 

Static Void Con_SelectJoin(Args _args) 

{ 

Con_car  car; 

Con_Rentcar Rent;  

while select car join rent where car.carId=rent.CarID 

{ info(strfmt("%1--%2",car.carId,rent.Carid} 

} 

 

---outer join-- 

while select car outer join rent where car.carid=rent.carid 

{ 

info(strfmt("%1--%2", car.carid,rent.carid); 

 

} 

 

--exists-- 

while select car exists join rent where car.carid=rent.carid 

{                                                        

info(strfmt("%1---%2", car.carid,rent.carid); 

} 

 

--notExists-- 

 

while select car notExists join rent where car.carid=rent.carid 

{ 

info(strfmt("%1---%2", car.carid,rent.carid)); 

} 

 

) 

No comments:

Post a Comment