|
Home > Archive > microsoft.public.cert.mcdba > July 2005 > Joining one to many relational table
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Joining one to many relational table
|
|
| sqllearner 2005-07-26, 11:47 am |
| I have two tables: Table1 has A,A,B,B,B and Table2 has A, B. I want to join
Table1 with Table2 and update Table1, but I want to update only 1 for A and 1
for B in Table1. How will I do it?
| |
| sqllearner 2005-07-26, 11:47 am |
| For Table1 the values for column1 is A,A,B,B,B and the correspoding values in
column2 is 2,2,3,3,3 and the correspoding values in column3 is 0,0,0,0,0. In
Table2 the values for column1 is A,B and the correspoding values in column2
is 2,3.
I want to update Table1.Column3 = 1, where Table1.Column1 = Table2.Column1
and Table1.Column2 = Table2.Column2. But using joins, I found it updates all
5 rows in Table1.Column3. But I want to update only 2 rows in Table1.Column3,
as Table2 has 2 rows. More specifically, I want to update one to one in this
one to many relational tables.
"sqllearner" wrote:
> I have two tables: Table1 has A,A,B,B,B and Table2 has A, B. I want to join
> Table1 with Table2 and update Table1, but I want to update only 1 for A and 1
> for B in Table1. How will I do it?
|
|
|
|
|