PC Review


Reply
Thread Tools Rate Thread

Concat fields from one table to other

 
 
vjp2.at@at.BioStrategist.dot.dot.com
Guest
Posts: n/a
 
      6th Jul 2012
How do I splice the two databases together based on "VSID" being the same
for each part of the record? Much obliged.

insert into qvot12 (FONE, EMAIL, g96, g97, g98, g99, g00, g01, g02, g03, g04,
g05, g06, g07, g08, g09)
VALUES (senatedata.FONE, senatedata.EMAIL,
senatedata.g96, senatedata.g97, senatedata.g98, senatedata.g99,
senatedata.g00, senatedata.g01, senatedata.g02, senatedata.g03,
senatedata.g04, senatedata.g05, senatedata.g06, senatedata.g07,
senatedata.g08, senatedata.g09)
SELECT senatedata.FONE, senatedata.EMAIL,
senatedata.g96, senatedata.g97, senatedata.g98, senatedata.g99,
senatedata.g00, senatedata.g01, senatedata.g02, senatedata.g03,
senatedata.g04, senatedata.g05, senatedata.g06, senatedata.g07,
senatedata.g08, senatedata.g09
FROM senatedata
inner join on qvot12
WHERE qvot12.VSID=senatedata.senBOEID;



- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://www.panix.com/~vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Phooey on GUI: Windows for subprime Bimbos]




 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      7th Jul 2012
On Fri, 6 Jul 2012 17:26:08 +0000 (UTC), (E-Mail Removed)
wrote:

>How do I splice the two databases together based on "VSID" being the same
>for each part of the record? Much obliged.
>
>insert into qvot12 (FONE, EMAIL, g96, g97, g98, g99, g00, g01, g02, g03, g04,
>g05, g06, g07, g08, g09)
> VALUES (senatedata.FONE, senatedata.EMAIL,
> senatedata.g96, senatedata.g97, senatedata.g98, senatedata.g99,
> senatedata.g00, senatedata.g01, senatedata.g02, senatedata.g03,
> senatedata.g04, senatedata.g05, senatedata.g06, senatedata.g07,
> senatedata.g08, senatedata.g09)
> SELECT senatedata.FONE, senatedata.EMAIL,
> senatedata.g96, senatedata.g97, senatedata.g98, senatedata.g99,
> senatedata.g00, senatedata.g01, senatedata.g02, senatedata.g03,
> senatedata.g04, senatedata.g05, senatedata.g06, senatedata.g07,
> senatedata.g08, senatedata.g09
> FROM senatedata
> inner join on qvot12
> WHERE qvot12.VSID=senatedata.senBOEID;
>
>


What do you mean by "each part of the record"? It sounds like you have two
tables, apparently with the same fieldnames; is that the case?

What fields do you want to concatenate? What do you want as a result? You
can't JOIN to a nonexistant record: are you trying to add new records from
senatedata into qvot12, or update existing records which are already in
qvot12, or what?

Remember - YOU can see your database. We cannot!
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also http://www.utteraccess.com
 
Reply With Quote
 
 
 
 
vjp2.at@at.BioStrategist.dot.dot.com
Guest
Posts: n/a
 
      7th Jul 2012
Many thanks.

I have two databases indexed on VSID.. I extracted VSID, emails and phones
and history from one database and I want to add it to each record of the
other database (which doesn't have them). Although I would prefer to
read it directly from the other mdb file instead of my current method of
putting it in an XLS then in a new table.

DOes Left Join have anything vaguely to do with this?

May I put INSERT INTO in an Access Query?




- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://www.panix.com/~vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Phooey on GUI: Windows for subprime Bimbos]




 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      7th Jul 2012
On Sat, 7 Jul 2012 04:01:18 +0000 (UTC), (E-Mail Removed)
wrote:

>Many thanks.
>
>I have two databases indexed on VSID.. I extracted VSID, emails and phones
>and history from one database and I want to add it to each record of the
>other database (which doesn't have them). Although I would prefer to
>read it directly from the other mdb file instead of my current method of
>putting it in an XLS then in a new table.
>
>DOes Left Join have anything vaguely to do with this?
>
>May I put INSERT INTO in an Access Query?


Do you have two DATABASES - .mdb or .accdb files, containers for multiple
Tables, Forms, Reports and code?

Or do you have two TABLES?

Databases cannot be "indexed by VSID" - tables can. I'm guessing you mean
tables.

And again - I'm guessing because you're using the jargon in a confusing way -
that both tables already exist and have these fields, and that you want to
take the data from the record with VSID = 12345 (or whatever) in the table
named senatedata and update the corresponding fields in the table named
qvot12. Is that the case? Or is qvot12 empty, or does it just not have records
for those VSID values.

It's possible that the table senatedata resides in one mdb file and the table
qvot12 resides in a different one. Is that the case?

ANY of these situations can be handled (without any need for an XLS
intermediary) but I do need to know where your tables are, what they contain
(existing matching records or new records to be added, etc.) before I can give
specific instructions.

Just a couple of ideas: you can UPDATE existing records using a JOIN:

UPDATE qvot12 INNER JOIN senatedata
ON qvot12.VSID = senatedata.VSID
SET qvot12.thisfield = senatedata.thisfield,
qvot12.thatfield = senatedata.thatfield,
qvot12.theotherfield = senatedata.theotherfield
WHERE <optional criteria>;

You can also APPEND new records into a table where they do not currently
exist:

INSERT INTO qvot12
SELECT VSID, thisfield, thatfield, theotherfield
FROM senatedata;

Both of these tables could be in the same .mdb file, or either one of them
could be linked using External Data to connect to a different .mdb file.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also http://www.utteraccess.com
 
Reply With Quote
 
vjp2.at@at.BioStrategist.dot.dot.com
Guest
Posts: n/a
 
      9th Jul 2012
I extracted t2 from another db, so I have two tables.

I have t1 wit N A B and t2 with N C D
and I want to have t1 with N A B C D

(Exaggerated simplicty.. Nw, I would prefer to get t2 from the other
database instead, but i have imported it already)



- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://www.panix.com/~vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Phooey on GUI: Windows for subprime Bimbos]




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Concat not working with linked table Debbiedo Microsoft Access Reports 3 28th May 2008 10:28 PM
how to concat from another table field w/in my select? ZX Microsoft Access Queries 3 15th Dec 2007 05:09 AM
One Table Relates to Many Fields In Other Table =?Utf-8?B?TXVycA==?= Microsoft Access Database Table Design 1 31st Mar 2005 02:55 AM
From one table -> update the fields from other table =?Utf-8?B?U2Ftb3Jh?= Microsoft Access Queries 1 25th May 2004 12:51 PM
dropdownlist-concat two fields-can it be done ctb Microsoft ASP .NET 2 18th Jul 2003 05:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:38 PM.