Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing Rows in same table

Status
Not open for further replies.

balushanmugham

Programmer
Jun 16, 2012
6
IN
I have a table with 4 columns.

EmpName PayDate WageType PayRate
ABC 10/22/2014 Regular 10.20
XYZ 10/22/2014 Regular 09.30
ABC 10/23/2014 Regular 10.20
ABC 10/24/2014 Regular 11.50
ABC 10/25/2014 Regular 11.20
XYZ 10/25/2014 Regular 09.30
ABC 10/26/2014 Regular 10.20
XYZ 10/26/2014 Regular 09.30



The output will be as below
EmpName PayDate WageType PayRate
ABC 10/22/2014 Regular 10.20
XYZ 10/22/2014 Regular 09.30
ABC 10/24/2014 Regular 11.50
ABC 10/26/2014 Regular 10.20

I have to write query to fetch the data whenever Payrate is changing for particular employee. Distinct can'y be used in this

scenario.
Here for the Employee ABC, Initially payrate is 10.20 then change to 11.50 and again change to 10.20. So three rows need to be

shown.
But for Employee XYZ initially payrate is 09.30 and not changing for further paydates. So XYZ shown only once.

Could You please suggest me how to write query to get this result..

Regards,
Bala
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top