Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computer Certification > MCSE > Joining one to many relational table

Reply
Thread Tools

Joining one to many relational table

 
 
=?Utf-8?B?c3FsbGVhcm5lcg==?=
Guest
Posts: n/a
 
      06-04-2005
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?
 
Reply With Quote
 
 
 
 
Mike T.
Guest
Posts: n/a
 
      06-04-2005
"sqllearner" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
>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?



Are A,A,B,B,B values for one column across 5 rows in Table1? Are there other
columns in Table1?

For the joins, SELECT DISTINCT might be an option. For the update, I need
more info.

Also, to use a New York phrase: Not for nothin', but this is the MCSE group.
You might have a bit more luck with one of the SQLServer groups.

--
Mike T.
MCNGP #XLI


 
Reply With Quote
 
 
 
 
=?Utf-8?B?c3FsbGVhcm5lcg==?=
Guest
Posts: n/a
 
      06-04-2005
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.


"Mike T." wrote:

> "sqllearner" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
> >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?

>
>
> Are A,A,B,B,B values for one column across 5 rows in Table1? Are there other
> columns in Table1?
>
> For the joins, SELECT DISTINCT might be an option. For the update, I need
> more info.
>
> Also, to use a New York phrase: Not for nothin', but this is the MCSE group.
> You might have a bit more luck with one of the SQLServer groups.
>
> --
> Mike T.
> MCNGP #XLI
>
>
>

 
Reply With Quote
 
Guest
Posts: n/a
 
      06-05-2005
A word of advice:

What you've described has the look of a pile of string, all colored the
same, and it seems as though you are asking us to sort it out for you by
length.

An image, diagram, or chart would probably help you, or anyone looking to
help you, to visualize what you are looking to accomplish. Labels other than
'Table' and 'Column' would also make things somewhat simpler to identify,
even if they are disguised so as not to give away your intricate little
conspiracy. Otherwise you will only be spreading confusion and wasting
people's time.

If you are looking to spread confusion and waste people's time, I applaud
your efforts, as you have achieved a great success, albeit limited by your
choice of publication locale, and the fact that I enjoy wasting my time, so
you have only achieved a partial waste of my time, which is lame.

I had to think for you and I claim my $2.50 {?1}.

Microcephalic S. Bob



"sqllearner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>
> "Mike T." wrote:
>
>> "sqllearner" <(E-Mail Removed)> schrieb im
>> Newsbeitrag
>> news:(E-Mail Removed)...
>> >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?

>>
>>
>> Are A,A,B,B,B values for one column across 5 rows in Table1? Are there
>> other
>> columns in Table1?
>>
>> For the joins, SELECT DISTINCT might be an option. For the update, I need
>> more info.
>>
>> Also, to use a New York phrase: Not for nothin', but this is the MCSE
>> group.
>> You might have a bit more luck with one of the SQLServer groups.
>>
>> --
>> Mike T.
>> MCNGP #XLI
>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?c3FsbGVhcm5lcg==?=
Guest
Posts: n/a
 
      06-05-2005
Dear Microcephalic S. Bob,

You hae already spent 100 words and some valuable (!) time to give advice
rather than give some idea to sole the problem. The message box do not take
table formating, thats why I need to explain the values in written format.
The main thing is that: You donot know the answer and try to blame other
people for that. Keep silent and do not waste your valuable time, if you
donot know the answer.
 
Reply With Quote
 
Guest
Posts: n/a
 
      06-05-2005


"sqllearner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dear Microcephalic S. Bob,
>
> You hae already spent 100 words and some valuable (!) time to give advice
> rather than give some idea to sole the problem.


First, my time is not valuable. I can type 100 words per minute. I slept
with your mother.

> The message box do not take
> table formating, thats why I need to explain the values in written format.


You're an imbecile. This has nothing to do with a message box. It's about
the fact that you have minimal to no communication skills, and that's why
you aren't going to get an answer to your problem. I'll add to this the fact
that you are in the wrong group to ask such a thing.

> The main thing is that: You donot know the answer and try to blame other
> people for that. Keep silent and do not waste your valuable time, if you
> donot know the answer.


I could figure out the answer, but you're not entitled to it if you're going
to try and blame me for the fact that you're too stupid to solve the problem
on your own instead of going to the wrong newsgroup and providing only
partial information.

It's not my job and not my responsibility to answer your problem.

Now you've made the fundamental mistake of attempting to insult someone who
was initially on your side, so you're on your own.

Microcephalic S. Bob
http://www.roblindman.com - elapsed time, 1 minute



 
Reply With Quote
 
Herb
Guest
Posts: n/a
 
      06-06-2005
UPDATE Table1 SET Table1.ColumnC = 1 FROM Table1 RIGHT JOIN Table2 ON
Table1.ColumnA = Table2.ColumnA AND Table1.ColumnB = Table2.ColumnB

"sqllearner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>
> "Mike T." wrote:
>
>> "sqllearner" <(E-Mail Removed)> schrieb im
>> Newsbeitrag
>> news:(E-Mail Removed)...
>> >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?

>>
>>
>> Are A,A,B,B,B values for one column across 5 rows in Table1? Are there
>> other
>> columns in Table1?
>>
>> For the joins, SELECT DISTINCT might be an option. For the update, I need
>> more info.
>>
>> Also, to use a New York phrase: Not for nothin', but this is the MCSE
>> group.
>> You might have a bit more luck with one of the SQLServer groups.
>>
>> --
>> Mike T.
>> MCNGP #XLI
>>
>>
>>



 
Reply With Quote
 
Guest
Posts: n/a
 
      06-06-2005
No. He should have used XMLDOM to export the data, which he could have then
imported through a recordset object and recreated the table with a MAKE
SHIFT query, and he would be happier if he would have used velveeta instead
of real cheese.

Microcephalic S. Bob

"Herb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> UPDATE Table1 SET Table1.ColumnC = 1 FROM Table1 RIGHT JOIN Table2 ON
> Table1.ColumnA = Table2.ColumnA AND Table1.ColumnB = Table2.ColumnB
>
> "sqllearner" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.
>>
>>
>> "Mike T." wrote:
>>
>>> "sqllearner" <(E-Mail Removed)> schrieb im
>>> Newsbeitrag
>>> news:(E-Mail Removed)...
>>> >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?
>>>
>>>
>>> Are A,A,B,B,B values for one column across 5 rows in Table1? Are there
>>> other
>>> columns in Table1?
>>>
>>> For the joins, SELECT DISTINCT might be an option. For the update, I
>>> need
>>> more info.
>>>
>>> Also, to use a New York phrase: Not for nothin', but this is the MCSE
>>> group.
>>> You might have a bit more luck with one of the SQLServer groups.
>>>
>>> --
>>> Mike T.
>>> MCNGP #XLI
>>>
>>>
>>>

>
>



 
Reply With Quote
 
Kline Sphere
Guest
Posts: n/a
 
      06-07-2005
>But using joins, I found it updates all
>5 rows in Table1.Column3.


maybe you have your joins round the wrong way.....

Kline Sphere (Chalk) MCNGP #3
 
Reply With Quote
 
FrisbeeŽ
Guest
Posts: n/a
 
      06-07-2005
"<!-- The F-Word --> <? echo "General Microcephalic S. Bob"; ?> <!--
Antisocial Interfaces --> // 270-290-291-293-294-298-299" <{
http://www.planetoftheheads.com/ - head first into the future }> wrote in
message news:(E-Mail Removed)...
> No. He should have used XMLDOM to export the data, which he could have
> then imported through a recordset object and recreated the table with a
> MAKE SHIFT query, and he would be happier if he would have used velveeta
> instead of real cheese.


Bate! Everybody knows Velveeta IS real cheese.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Joining one to many relational table sqllearner MCAD 2 06-09-2005 08:27 PM
Joining one to many relational table sqllearner MCSA 0 06-04-2005 10:24 PM
Joining one to many relational table =?Utf-8?B?c3FsbGVhcm5lcg==?= MCSD 2 06-04-2005 10:21 PM
Objects/Relational Mapping Software - Which one is the best? NOSPAM ASP .Net 0 10-19-2004 01:36 PM
modeling an object many to many relationship with a transactional bridge table Jim Thomason Perl Misc 3 10-02-2004 05:06 PM



Advertisments