Query to Display Employee Hike Details

EID ENAME SAL SALMONTH
101 xyz 100 Jan 2015
101 xyz 200 Feb 2015
102 Abc 300 Feb 2015
I want output like this
Eid Ename hike
101 xyz 100
102 Abc 0

Showing Answers 1 - 3 of 3 Answers

abid

  • Jul 30th, 2015
 

Code
  1.  

  Was this answer useful?  Yes

dan

  • Jul 31st, 2015
 

The question is poorly stated, perhaps partially stated as well. But it is good that basic sample data is given. Does the table have data only for Jan 2015 and Feb 2015.?
What if the salary changes were more than once in the same month?
Given the sample expected result (which to be commended as well, because it makes the question clearer) the result can be achieved through multiple queries.

Q1. Query to produce EID, ENAME only.
Q2. Query to produce the EID, SAL for Feb 2015.
Q3. Query to produce the EID, SAL for Jan 2015.
Q4. Query to produce the EID, SAL_2015_02, SAL_2015_01
Q5. Query to produce the EID, SAL_2015_01, SAL_2015_01 (where Q2 has no data for EID)
Q6. Query to UNION the Q4 and Q5 data as EID, SAL_2015_02, SAL_2015_01
Q7. Query to produce the final result.

  Was this answer useful?  Yes

Akash

  • Aug 15th, 2017
 

Can you elaborate what you are solving its not about duplicates

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions