• Select EmpName, DateOfLeaving from Employees order by DateOfLeaving desc, EmpName asc

    That's just wrong. :hehe:

    DECLARE @Employees table (

    EmpName varchar(5),

    DateOfLeaving datetime

    )

    insert into @Employees select 'Abc', '10 Oct 1999'

    insert into @Employees select 'Bcd', '11 Nov 1998'

    insert into @Employees select 'Ccd', NULL

    insert into @Employees select 'Dcd', '10 Aug 2000'

    insert into @Employees select 'Eed', NULL

    Select

    EmpName,

    DateOfLeaving

    from @Employees

    order by DateOfLeaving desc, EmpName asc

    Dcd 2000-08-10 00:00:00.000

    Abc 1999-10-10 00:00:00.000

    Bcd 1998-11-11 00:00:00.000

    Ccd NULL

    Eed NULL

    Only the 2nd chioice

    Select

    EmpName,

    DateOfLeaving

    from @Employees

    order by isnull(DateOfLeaving, '10/10/9999'),EmpName asc

    will give the desired output...

    Bcd 1998-11-11 00:00:00.000

    Abc 1999-10-10 00:00:00.000

    Dcd 2000-08-10 00:00:00.000

    Ccd NULL

    Eed NULL

    😉

    Tom Garth
    Vertical Solutions[/url]

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers