Re: Joining one to many relational table
- From: "Changgyu Oh" <coh@xxxxxxxxxxxxxxx>
- Date: Thu, 9 Jun 2005 15:27:10 -0500
Best way to do it is, I believe, to use a cursor.
Since your table1 violates the first normalization, join query does not
solve your problem.
"Cindy Winegarden" <cindy_winegarden@xxxxxxx> wrote in message
news:OgFvOtXaFHA.2756@xxxxxxxxxxxxxxxxxxxxxxx
> Hi Learner,
>
> If you want to update only one of several matching rows then you'll have
> to find a way to specify exactly which row to update. Do the rows have a
> primary key? Could you target the row with the Min(Pk) where all the other
> conditions are met?
>
> --
> Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
> cindy_winegarden@xxxxxxx www.cindywinegarden.com
> Blog: http://spaces.msn.com/members/cindywinegarden
>
>
> "sqllearner" <sqllearner@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:E364C30A-F43A-4B4D-A4D6-508B56DC41C2@xxxxxxxxxxxxxxxx
>>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?
>>
>> 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.
>
>
.
- References:
- Joining one to many relational table
- From: sqllearner
- Re: Joining one to many relational table
- From: Cindy Winegarden
- Joining one to many relational table
- Prev by Date: What Help File on Exam
- Next by Date: Welcome Kit
- Previous by thread: Re: Joining one to many relational table
- Next by thread: Passed 306
- Index(es):
Relevant Pages
|