sunojsm Warnings : 1 New User
Joined: 21 Jun 2004 Posts: 48 Location: Heaven
|
|
|
|
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 |
|
ovreddy
Active User
Joined: 06 Dec 2004 Posts: 200 Location: Keane India Ltd., Hyderabad
|
|
|
|
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. |
|