Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mowali
Starting Member
2 Posts |
Posted - 2009-10-30 : 18:38:14
|
| We have a rating scale that we give to our vendors. Many of the vendors now have sub companies. So, we have parent table called Vendor and child table that lists the sub companies of each vendor. We want to split that rating among the sub companies. The idea is to set the same scale for now on the child and we will modify them as we go. To elaborate the SQL structure, it is as follows:1. Parent table called Vendor2. Child table that lists all the sub companies for each vendor. It is linked to the parent obviously via the primary VendorID. 3. The Vendor table has one column called Rating (from 1-5)4. I want to move that column with its current value to all the sub companies child table. I know I can use cursor to do this, but the amount of data is huge and may consume lots of memory on the server. Is there a simpler query that can do this?? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-31 : 01:24:29
|
seems like this?UPDATE sSET s.Rating=p.RatingFROM Child sINNER JOIN Parent pON p.Vendor_ID=s.Vendor_ID |
 |
|
|
mowali
Starting Member
2 Posts |
Posted - 2009-11-02 : 09:55:48
|
| It worked nicely, thank you. |
 |
|
|
|
|
|