[Solved] Inserting data from one table to another table

Creating tables and queries

[Solved] Inserting data from one table to another table

Postby nubb mike » Tue Jan 12, 2016 4:19 pm

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
nubb mike
 
Posts: 3
Joined: Mon Jan 11, 2016 11:25 pm

Re: Inserting data from one table to another table

Postby MTP » Tue Jan 12, 2016 5:25 pm

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

Postby nubb mike » Tue Jan 12, 2016 8:17 pm

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
nubb mike
 
Posts: 3
Joined: Mon Jan 11, 2016 11:25 pm


Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 2 guests