Home » SQL & PL/SQL » SQL & PL/SQL » split from Update 7% basic Salary by bb
split from Update 7% basic Salary by bb [message #651505] Thu, 19 May 2016 05:21 Go to next message
Salehin
Messages: 62
Registered: March 2013
Location: Chittagong, Bangladesh
Member
Dear brother & Sister, I am facing a small problem in my office, we have separate column for separate section i.e. Cutting, Finishing, Quality, Operator etc.

I have to run my code separately for each section. Is there any code to run in one time, I run N_GROSS_OP for Operator, N_GROSS_qc for Qualtiy, N_GROSS_fin for Finishing, N_GROSS_cut for Cutting.

UPDATE emp_payment p
SET p.N_GROSS_OP = p.N_GROSS_OP + (((p.N_GROSS_OP - 1100) / 1.4) * .07),
p.gross=p.N_GROSS_op
WHERE empno IN
(SELECT o.empno
FROM emp_official o, emp_personal ep
WHERE o.joining_date BETWEEN '01-may-2015' AND '31-may-2015'
AND O.COMPANY_NAME='Clifton Apparels Ltd'
AND EP.STATUS='Active'
and o.section_name = 'Sewing'
and o.ot_ent = 'Yes'
and p.grade between '3' and '6'
and o.empno=ep.empno)
/

Please help

Re: Update 7% basic Salary [message #651510 is a reply to message #651505] Thu, 19 May 2016 06:01 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
That seems like a fundamental design flaw.
So emp_payment has multiple gross columns but for any given empno only one of the columns is populated?
If that's not the case you need to describe the relationship between the tables in more detail.
If it is the case then separate updates for each type is probably the simplest approach. There will be ways to do it in one but the SQL will be complicated and I doubt it'll be faster than separate updates so there's really no benefit.
Re: Update 7% basic Salary [message #651519 is a reply to message #651505] Thu, 19 May 2016 07:16 Go to previous message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
Your new problem should be a new thread. Please do not expect a single thread to be your continuing, open-ended discussion of your problem de jour.
Previous Topic: timestamp question
Next Topic: Query reporting
Goto Forum:
  


Current Time: Fri Apr 19 22:32:14 CDT 2024