-
Update a field using a w/Join. Please Help.
I am tryin t to update the tbl1_ID from the tbl2_ID. How do I do a Update Join that will do a comparison on the param column and value columns so that I could get the correct ID into tble 1.
Tbl1 is my destination table and tbl2 is my source. Please Help.
ID Tbl1_ID tb1Param tbl1value
1 NULL Param1 0
1 NULL Param2 F
1 NULL Param3 2
3 NULL Param1 0
3 NULL Param2 E
3 NULL Param3 0
5 NULL Param1 0
5 NULL Param2 F
5 NULL Parma3 2
tbl2_ID tbl2Param tbl2value
100 param1 0
101 param1 1
102 param1 2
103 param1 3
104 param1 4
105 param2 E
106 param2 F
107 param2 H
108 param2 HF
109 param2 HS
110 param2 L
111 param2 LS
112 param3 0
113 param3 1
114 param3 2
115 param3 3
116 param3 4
117 param3 5
118 param3 6
Here is what Im trying to do if you can understand this.
Update Tbl1
SET tb1ID = B.tbl2_ID
FROM tbl1 AS A JOIN tbl2 AS B
ON A.tbl1Param + A.tbl1Value = B.tbl2Param + A.tbl2value
-
Never mind, I figured it out.
-
--try
--I don't know what are you want to do ! please tell us particular
Update Tbl1
SET tb1ID = B.tbl2_ID
FROM tbl1 AS A JOIN tbl2 AS B
ON A.tbl1Param + A.tbl1Value = B.tbl2Param + B.tbl2value
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|