home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,822 of 19,505   
   Tony to All   
   How do I write this sql statement   
   20 Feb 13 15:25:26   
   
   From: tony.johansson@inport.com   
      
   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   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca