Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Comparing Rows in same table

Comparing Rows in same table

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

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

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..


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close