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 |
|
jayram11
Yak Posting Veteran
97 Posts |
Posted - 2010-09-22 : 16:08:15
|
| HiI have table A with code and description variableTable B with ID and Descriptions variabletable C with Type and Definition variabletable ACODE DescriptionBA141 Nulltable BID DescriptionsBA1 long marchtable CType Definitions41 to heaveni need to populate table A with Long March to heaven from table B and Ctable ACODE DescriptionBA141 long march to heavenbasically the first three left characters comes from table B and last 2 from table C. My table A has a 1000 record with combination of ID and type as code from Table B and C. i have some 30+ ID in B and 30+ in CCanyou haelp?Jkr |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-09-22 : 17:46:13
|
| UPDATE ASET DESCRIPTION = b.Descriptions + c.DefintionsFROM tableA AINNER JOIN tableB B ON LEFT(a.CODE,3) = b.IDINNER JOIN tableC C ON RIGHT(a.code,2) = c.[type]This will get a lot harder when you want to account for Codes that aren't 5 characters long, or link on somthing other than lefft 3 and right 2JimEveryday I learn something that somebody else already knew |
 |
|
|
|
|
|