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,719 of 19,505   
   Gene Wirchenko to post.philipp@googlemail.com   
   Re: Reducing to One Query   
   17 Aug 12 09:15:50   
   
   From: genew@ocis.net   
      
   On Fri, 17 Aug 2012 06:23:01 -0700 (PDT), Philipp Post   
    wrote:   
      
   >If this should work in MS Access you will end up with something like that -   
   same as your query without the temp table.   
   >   
   >SELECT S.Team, S.PlayerName   
   >FROM Stats AS S   
   >INNER JOIN   
   >  (SELECT Max(pct) As max_pct, Team   
   >   FROM Stats AS S   
   >   GROUP BY Team) AS T1   
   >ON S.pct = T1.max_pct   
   >  AND S.Team = T1.Team   
   >;   
      
        Thank you.  I modified it lightly to match with exactly what I   
   wanted:   
      
   SELECT S.*   
   FROM #Stats AS S   
   INNER JOIN   
     (SELECT Max(pct) As max_pct,Team   
      FROM #Stats AS S   
      GROUP BY Team) AS T1   
   ON S.pct = T1.max_pct   
     AND S.Team = T1.Team   
   order by theRank   
      
        It was the second inner join select that was giving me trouble.   
      
   Sincerely,   
      
   Gene Wirchenko   
      
   --- 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