Ankit  Shukla

Ankit Shukla

  • NA
  • 681
  • 117.6k

How to write stored procedure for this problem

Jun 15 2020 2:20 AM
Hello,
 
I have 2 tables.
 
Table1: Emp_Profile
 
Emp_Code    Emp_Name    Rank  Salary
E1                         A                1        40K
E2                         B                2        30K
E3                         C                3        25K
E4                         D                3        25K
 
Table2: Emp_Promotion
 
 Emp_Code    Rank
  E2                   1
  E3                   2
 
 
 
 I need all emp. details but condition is: If employee is promoted, then Rank will comes from Emp_Promotion table.
 
Output looks like:
 
 
Emp_Code  Emp_Name   Rank   Salary
E1                   A                  1         40K
E2                   B                  1         30K
E3                   C                  2         25K
E4                   D                  3         25K
 
 
 Please help.

Answers (4)