Concat fields from one table to other

V

vjp2.at

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]
 
J

John W. Vinson

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/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
V

vjp2.at

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]
 
J

John W. Vinson

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/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
V

vjp2.at

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top