Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2015
    Posts
    31

    Unanswered: having.. group by

    Good Morning,
    I would like from this input records

    entity member Date
    01 mem1 2014
    01 mem2 2013
    01 mem3 2015
    02 mem4 2010
    02 mem5 2011
    02 mem6 2012

    have the following result , take the last member for each entity

    01 mem3 2015
    02 mem6 2012


    Thnak you

  2. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hi,

    try this:
    Code:
    select entity, member, date
    from (
    select e.*, rownumber() over(partition by entity order by date desc) rn_
    from mytable e
    )
    where rn_=1
    Regards,
    Mark.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •