I am using sql server I have a two fields Name , in_time records are 1 abc 10.12.25 2 abc 11.18.36 3 abc 12.14.38 4 abc 14.19.23 5 pqr 10.30.56 6 pqr 11.26.58 7 pqr 12.30.21 what I want is name wise time differences between two records. i.e. time of second record - time of first record of abc time of third record - time of third record of abc and so on