Need help to produce SQL

  • I've table and data as follow,

    declare @t1 table

    (idx int, maintdte datetime);

    insert into @t1 values(1,'20100723 7:40:23');

    insert into @t1 values(2,'20100721 14:39:45');

    insert into @t1 values(3,'20100721 11:15:05');

    How to display the output as follow,

    idx | maintdte

    ----------------------------------------

    22010-07-21 14:39:45.000

    32010-07-21 11:15:05.000

    As you can see, the latest maintdte (20100723 7:40:23) will not be displayed

    Looking for help

  • That will do what you asked for, but I have doupts that it is what you really want...

    select *

    from @t1 where maintdte != (select MAX(maintdte) from @t1)

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • tq sir

  • select *

    from @t1 where maintdte < (select MAX(maintdte) from @t1)

    [font="Comic Sans MS"]Praveen Goud[/font]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply