Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
SQL Queries needed for the mentioned Problems

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
sunojsm
Warnings : 1

New User


Joined: 21 Jun 2004
Posts: 48
Location: Heaven

PostPosted: Fri Mar 25, 2005 5:05 pm    Post subject: SQL Queries needed for the mentioned Problems
Reply with quote

hi,
Can anybody gave me query for the below pblm.

1) I am provided with two columns TRAN_DATE,BALANCE for a table which has the bank balance for an ATM user on each day from january to march25.I want to find the average of the bank balance from feb1 to feb 28 in embedded sql,the average bank balance should be transferred to a host variable.

2) I have 5 coloumns for a PAYROLL table .they r ROLLNO,BASIC PAY,HRA,DA,TOTAL_SAL.While creating table i gave WITH DEFAULTS for total_sal & remaining with NOT NULL. ROLLNO is declared as integer while the others r declared as decimal. I want to add the value of BASIC,HRA,DA for each row & update the total_sal which originally has zeroes with the summed up value .What is the query for this.

I WANT RESPONSE IN THE FORM OF SQL QUERIES & NOT SUGGESTIONS TO SOLVE THE PROBLEM

bye
Back to top
View user's profile Send private message
References
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 200
Location: Keane India Ltd., Hyderabad

PostPosted: Fri Mar 25, 2005 6:13 pm    Post subject:
Reply with quote

Hi,

1 Ans: SELECT AVG(BAL) INTO :HV-AVG WHERE TRAN_DATE >='2005-02-01' AND TRAN_DATE<='2005-02-28';


2 Ans: UPDATE PAYROLL SET TOTAL_SAL=BASIC+HRA+DA WHERE TOTAL_SAL=0;

Thanks,
Reddy.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1