| Author |
Topic  |
|
|
sadbjp
INNER JOIN
41 Posts |
Posted - 05/11/2007 : 13:34:32
|
Hi, I have two tables:
1. RubricReportDetail with columns LocalPerf, Age 2. SppIndicator with columns Pct, Age
How can I populate the values of LocalPerf with Pct by matching
RubricReportDetail.Age = SppIndicator.Age ??
Please help me. Thanks in advance.
|
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
Posted - 05/11/2007 : 13:40:40
|
UPDATE r SET LocalPerf = s.Pct FROM RubricReportDetail r INNER JOIN SppIndicator s ON r.Age = s.Age
Tara Kizer http://weblogs.sqlteam.com/tarad/ |
 |
|
|
sadbjp
INNER JOIN
41 Posts |
Posted - 05/11/2007 : 13:42:20
|
Hi, Thanks for the response. What if I don't wanto join INNER join. Is there any other way (simplest one ) to do this?
Let me know. Thanks very much. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
sadbjp
INNER JOIN
41 Posts |
Posted - 05/11/2007 : 13:45:46
|
| It is certainly not a homework assignment but I hate using INNER joins, I want to use another method (just want to avoid joins). Can I use WHERE clause in this? |
 |
|
|
spirit1
Cybernetic Yak Master
Slovenia
11741 Posts |
Posted - 05/11/2007 : 13:48:29
|
you hate using inner joins???
maybe you should change the field you work in?
joins are a basis of set operations and thus Databases.
EDIT: fixed some typos
_______________________________________________ Causing trouble since 1980 blog: http://weblogs.sqlteam.com/mladenp |
Edited by - spirit1 on 05/11/2007 13:49:45 |
 |
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
|
|
sadbjp
INNER JOIN
41 Posts |
Posted - 05/11/2007 : 14:05:14
|
| Thanks for the help but didn't asked for your opinions about my likes and dislikes. |
 |
|
|
jsmith8858
Dr. Cross Join
USA
7423 Posts |
Posted - 05/11/2007 : 14:08:50
|
sadbjp -- it is not an opinion to state that if you don't "like joins", you shouldn't be working with a relational database. that's a fact.
- Jeff http://weblogs.sqlteam.com/JeffS
|
 |
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
Posted - 05/11/2007 : 14:08:59
|
It's not about likes and dislikes; it's about writing good, efficient code.
The most efficient way to do this is with a join.
Tara Kizer http://weblogs.sqlteam.com/tarad/ |
 |
|
|
sadbjp
INNER JOIN
41 Posts |
Posted - 05/11/2007 : 14:13:33
|
| Alright guys..lets end this here. Thanks once again for your help and guidance. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 05/14/2007 : 08:45:57
|
UPDATE d
SET d.LocalPerf = (SELECT i.PCT FROM SppIndicator AS i WHERE i.Age = d.Age)
FROM RubricReportDetail AS d
Peter Larsson Helsingborg, Sweden |
 |
|
|
Vijaykumar_Patil
Posting Yak Master
India
121 Posts |
Posted - 05/14/2007 : 09:35:13
|
Isn't this slower than Tara's method. Which I normally use.
Necessity is the mother of all inventions! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 05/14/2007 : 10:23:25
|
It can be. It depends on how smart SQL Server is. But it meets OP original condition, NO JOIN ALLOWED.
Peter Larsson Helsingborg, Sweden |
 |
|
|
madhivanan
Premature Yak Congratulator
India
22460 Posts |
Posted - 05/14/2007 : 10:55:59
|
quote: Originally posted by sadbjp
It is certainly not a homework assignment but I hate using INNER joins, I want to use another method (just want to avoid joins). Can I use WHERE clause in this?
Which of the following is correct? 1 You dont know how to use Join 2 You are new to sql and want to use front end's row by row operation (as suggested cursor) 3 You dont know how to justify the statement "I hate using INNER joins" 
Madhivanan
Failing to plan is Planning to fail |
 |
|
| |
Topic  |
|