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

From "Tony" <tony.johansson@inport.com>
Newsgroups comp.databases.ms-sqlserver
Subject How do I write this sql statement
Date 2013-02-20 15:25 +0100
Organization A noiseless patient Spider
Message-ID <kg2mau$13a$1@dont-email.me> (permalink)

Show all headers | 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