在T-SQL(MSSql 2008R2)中,我想从一个表或一组结果中选择某些行;根据其最小最大值选择某些行
StoreId StoreName BrochureId PageId Rank Distance
43561 X 1627 11608 73 598.10
43561 X 1627 11591 68 598.10
43561 X 1627 11615 41 598.10
43827 Y 1727 21708 75 1414.69
43827 Y 1727 21591 62 1414.69
43827 Y 1727 21615 44 1414.69
43919 Z 1827 31809 77 2487.35
43919 Z 1827 31591 60 2487.35
43919 Z 1827 31615 39 2487.35
想只选择距离最近且排名最高的行,
StoreId StoreName BrochureId PageId Rank Distance
43561 X 1627 11608 73 598.10
43827 Y 1727 21708 75 1414.69
43919 Z 1827 31809 77 2487.35
谢谢你的帮忙。
谢谢你的帮助,这个结果正是我想达到的目标。 – Buyukcaglar