Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1396

How do I write this sql statement

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
From "Tony" <tony.johansson@inport.com>
Newsgroups comp.databases.ms-sqlserver
Subject How do I write this sql statement
Date Wed, 20 Feb 2013 15:25:26 +0100
Organization A noiseless patient Spider
Lines 1
Message-ID <kg2mau$13a$1@dont-email.me> (permalink)
Mime-Version 1.0
Content-Type text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding 7bit
Injection-Date Wed, 20 Feb 2013 14:24:30 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="04290fff4557273ca84c3ad616751e0b"; logging-data="1130"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Xk6KhON29ML9Mcfl6sKbgYh0YZl4o/2w="
X-MimeOLE Produced By Microsoft MimeOLE V15.4.3555.308
X-Newsreader Microsoft Windows Live Mail 15.4.3555.308
Importance Normal
Cancel-Lock sha1:9TTE30QP7hU1EhGwxfyK5ve6ECk=
X-Priority 3
X-MSMail-Priority Normal
Xref csiph.com comp.databases.ms-sqlserver:1396

Show key headers only | View raw


In the database we have a column called grefnr and loopnr.
Each record could have something like the following se below. I want to
select the record with the highest loopnr number for every grefnr.
In this example I would get the following three record  1 78 and 2  95 and 3
99
How can I write this sql
grefnr    loopnr
1               34
1                12
1                78
1                35
2               4
2                72
2                70
2                95
3               11
3                16
3                99
3                7

//Tony 

Back to comp.databases.ms-sqlserver | Previous | NextNext in thread | Find similar


Thread

How do I write this sql statement "Tony" <tony.johansson@inport.com> - 2013-02-20 15:25 +0100
  Re: How do I write this sql statement tony@mountifield.org (Tony Mountifield) - 2013-02-20 14:42 +0000

csiph-web