[Solved] Inserting data from one table to another table

Creating tables and queries
Post Reply
nubb mike
Posts: 3
Joined: Mon Jan 11, 2016 11:25 pm

[Solved] Inserting data from one table to another table

Post by nubb mike »

i have two simple tables that have one field in common. i have been successful in linking and sorting correctly using a query but i can not seem to be able to pull the information from table 2 (WEEK NUMBER 2016) to table 1 (TIME CARD) table record field into the other. my sql query is

SELECT
"TIME CARD"."ID",
"WEEK ENDING 2016"."ID",
"TIME CARD"."WEEK ENDING",
"WEEK NUMBER 2016"."DATE",
"WEEK NUMBER 2016"."WEEK NUMBER",
"TIME CARD"."WEEK #"
FROM
"WEEK NUMBER 2016",
"TIME CARD"
WHERE
"WEEK NUMBER 2016"."DATE" = "TIME CARD"."WEEK ENDING"

i am having difficulty in taking the data from "WEEK NUMBER 2016"."WEEK NUMBER" and inserting it into "TIME CARD"."WEEK #"
i have tried various tries with insert, append, but can't seem to get it. maybe i am trying to do this in the wrong location ie. query verses maybe a form query. but it seemed more logical to do it this way.
Last edited by Hagar Delest on Mon Jan 18, 2016 12:36 am, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 4.12 on Windows 7 Professional
User avatar
MTP
Volunteer
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: Inserting data from one table to another table

Post by MTP »

The Base query window only accepts SELECT queries. If you want to run any other kind of SQL (such as INSERT) use instead the Tools→SQL window.

It is generally bad database design to store the same information in two tables. If you can show all the relevant information in a query, there is no need to add an additional column to your TIME CARD table, and that additional column would introduce some subtle pitfalls and difficulties in form and query design as your database gets complex.
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
nubb mike
Posts: 3
Joined: Mon Jan 11, 2016 11:25 pm

Re: Inserting data from one table to another table

Post by nubb mike »

Thank you MTP
I had a feeling that i was approaching this the wrong way. i will attack this issue in the forms realm.
OpenOffice 4.12 on Windows 7 Professional
Post Reply