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 17,764 of 19,505    |
|    Plamen Ratchev to All    |
|    Re: Simple query help - selecting row wi    |
|    25 Feb 10 10:49:44    |
      From: Plamen@SQLStudio.com              This can be done easier using the ranking functions:              SELECT name, total_price, price_item_1, price_item_2, price_item_3       FROM (       SELECT name, total_price, price_item_1, price_item_2, price_item_3,        ROW_NUMBER() OVER(PARTITION BY name ORDER BY total_price DESC) AS rk       FROM Foo) AS T       WHERE rk = 1;              --       Plamen Ratchev       http://www.SQLStudio.com              --- 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