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,347 of 2,288   
   Frank van Bortel to Ariel Jakobovits   
   Re: SQL to aggregate values into LIST   
   26 Apr 04 20:02:45   
   
   From: fvanbortel@netscape.net   
      
   Ariel Jakobovits wrote:   
      
   > I have a table with 2 primary keys, one is a foreign key, the other is   
   > produced by a sequence.   
   >   
   > I want to SELECT query for one record that has a list of the   
   > sequence-produced values for all records with a given foreign-key   
   > value, essentially:   
   >   
   > Create table table1 {   
   > fk_id number,   
   > seq_id number   
   > }   
   >   
   > SELECT fk_id, LIST(seq_id)   
   > FROM table1   
   > WHERE fk_id = 1   
   > GROUP BY fk_id   
   >   
   > Is there a way to do this?   
      
   SELECT seq_id   
   FROM table1   
   WHERE fk_id = 1   
      
   Or:   
   SELECT fk_id, seq_id   
   FROM table1   
   GROUP BY fk_id   
      
   BTW - your table has (and can have!) only one   
   primary key.   
   --   
      
   Regards,   
   Frank van Bortel   
      
   --- 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