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 |
|
M.E.
Aged Yak Warrior
539 Posts |
Posted - 2002-11-01 : 12:56:09
|
| I'll give an example here. It's kinda rushed, but hopefully you get the idea.create table X(RID int,PID varchar(45),value varchar(50))Create table y(RID int,pida varchar(45),pidb varchar(25))I want to join tables x and y together to get the value from x for each entry in y. the relationship is one X to many Y. In table Y PID is 2 values. In table X it's one value... PIDA + PIDB = PID My question is what would be faster/more effiecent for sql server to run....select y.rid, x.valuefrom y inner join x on y.rid = x.rid andy.PIDA + ' ' + y.PIDB = x.PIDorUpdate y set PIDA = y.PIDA + ' ' + y.PIDBgo select y.rid, x.valuefrom y inner join x on y.rid = x.rid andy.PIDA = x.PIDDon't worry about the data and that sort... I'm just wondering if updating the key then joining is more effiecient then just combining the values in the innerjoin[edit]Bleh, missing comma's in my create tables. How messy[/edit]-----------------------SQL isn't just a hobby, It's an addictionEdited by - m.e. on 11/01/2002 12:58:12 |
|
|
|
|
|