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,558 of 2,288   
   amwi to amwi   
   Re: update table a.fkid from table b.pki   
   14 Jul 04 19:13:41   
   
   From: amwi@yahoo.com   
      
   "amwi"  wrote in message   
   news:6udJc.98556$dP1.331930@newsc.telia.net...   
   > I have tried to solve this on my own for a long time now, so i really need   
   > some help here...   
   >   
   > I use Oracle 10.1 and SQL *plus 10.1.   
   >   
   > How do i update table a.fkid from table b.pkid with the following "rule".   
   > The table b.pkid's should be evenly distributed over table a as fkid's.   
   >   
   > Does anyone have a tip on how to solve this?   
   >   
   > Thank you.   
   >   
   >   
   An example:   
      
   Table b contains 10 rows with specific id's (primary keys).   
   Table a contains 10000 rows and contains a fk to table b.id.   
   The problem is to update the 10000 fk's in table a so that the 10 pk's in   
   table a is spread evenly into 10000 items in table a.   
      
   That is:   
   The first id in table b is written to 1000 rows in table a.   
   The second id in table b is written to the next 1000 rows in table a.   
   ...   
   The twentieth id in table b is written to the last 1000 rows in table a.   
      
   This is the basic idea and it should be real easy to solve in SQL,   
   somehow...   
      
   Thank you   
      
   --- 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