Query grabs a set of chars from a field making a new field

G

Guest

I have a long set of data in a table called New_Export with just one field I
call Field1.

I want to grab the set of chars 1 thru 18 and make them the field Rec_Ident
in the table Clean_Export and then take the remaining information from the
record (chars 19 thru the end) and put them into Rec_Detail in table
New_Export

I want the original table data to remain the same.
I just want the new table populated.
 
G

Guest

INSERT INTO Clean_Export (Rec_Ident, Rec_Detail)
SELECT Left([Field1],18), Mid([Field1],19)
FROM New_Export
 
G

Guest

SELECT Left([Field1],18) AS Rec_Ident,
Mid([Field1],19) AS Rec_Detail
INTO Clean_Export
FROM New_Export
ORDER BY Left([Field1],18), Mid([Field1],19);
 
G

Guest

Thank you!

Now I need to compare Rec_Ident and Rec_Detail from Clean_Export against the
Last_Week table with the field names LW_RecIdent and LW_RecDetail.
LW_RecIdent. I believe I would have to set up the RecIdent fields as keys in
both tables and set up a relationship between them, is that all correct?

Larry said:
INSERT INTO Clean_Export (Rec_Ident, Rec_Detail)
SELECT Left([Field1],18), Mid([Field1],19)
FROM New_Export

julialatte said:
I have a long set of data in a table called New_Export with just one field I
call Field1.

I want to grab the set of chars 1 thru 18 and make them the field Rec_Ident
in the table Clean_Export and then take the remaining information from the
record (chars 19 thru the end) and put them into Rec_Detail in table
New_Export

I want the original table data to remain the same.
I just want the new table populated.
 
J

John Spencer

You need to set up a query with the two tables related to each other by the
appropriate fields. You don't need to set the fields as key fields.

An sql statement to do this might look like:
SELECT *
FROM Clean_Export INNER JOIN Last_Week
On Clean_Export.Rec_Ident = Last_Week.LW_RecIdent
and Clean_Export.Rec_Detail = Last_Week.LW_RecDetail


julialatte said:
Thank you!

Now I need to compare Rec_Ident and Rec_Detail from Clean_Export against
the
Last_Week table with the field names LW_RecIdent and LW_RecDetail.
LW_RecIdent. I believe I would have to set up the RecIdent fields as keys
in
both tables and set up a relationship between them, is that all correct?

Larry said:
INSERT INTO Clean_Export (Rec_Ident, Rec_Detail)
SELECT Left([Field1],18), Mid([Field1],19)
FROM New_Export

julialatte said:
I have a long set of data in a table called New_Export with just one
field I
call Field1.

I want to grab the set of chars 1 thru 18 and make them the field
Rec_Ident
in the table Clean_Export and then take the remaining information from
the
record (chars 19 thru the end) and put them into Rec_Detail in table
New_Export

I want the original table data to remain the same.
I just want the new table populated.
 

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

Top