home bbs files messages ]

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

   comp.databases.oracle      Overblown overpriced overengineered SHIT      2,288 messages   

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

   Message 1,590 of 2,288   
   Michael J. Moore to Tao   
   Re: query help   
   24 Jul 04 02:54:38   
   
   From: DoNThicamelSPAM@comcast.net   
      
   select el2,min(el3||' '||el1) from test group by el2   
      
   where el2 is fieldA and el3 is fieldB and el1 is P_Key   
      
   I know there is a better way   
      
      
   "Tao"  wrote in message   
   news:5db74e62.0407231737.36c7003@posting.google.com...   
   > Hi SQL Masters,   
   >   
   > I know its probably a simple query, but I've spent a long time on it   
   > and could not figure it out.   
   >   
   >   
   > I'm trying to select distinct fieldA in the table, such that fieldB   
   > is smallest within each fieldA. Suppose the table has following rows:   
   >   
   > P_Key fieldA fieldB   
   > 1     1      5   
   > 2     1      4   
   > 3     2      4   
   > 4     2      3   
   >   
   > The result of the query would look like:   
   >   
   > P_Key fieldA fieldB   
   > 2     1      4   
   > 4     2      3   
   >   
   > Appreciate your help!   
      
   --- 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