sql - how to get the unique records with min and max for each user -
i have following table:
id gender age highest weight lowest weight abc f 30 90 70 1.3 f 30 90 65 null f 30 null null 1.3 b m 40 100 86 2.5 b m 40 null 80 2.5 c f 50 105 95 6.4 i need result in sql server. need minimum of weight , maximum of weight , 1 record per user.
id gender age highest weight lowest weight abc f 30 90 65 1.3 b m 40 100 80 2.5 c f 50 105 95 6.4
just grouping:
select id, max(gender), max(age), max([highest weight]), min([lowest weight]), max(abc) sometable group id
Comments
Post a Comment