[Solved] Store data simultaniously in 2 tables

Discuss the database features
Post Reply
dreamquartz
Posts: 881
Joined: Mon May 30, 2011 4:02 am

[Solved] Store data simultaniously in 2 tables

Post by dreamquartz »

Hi All,

I would like to be able to store information in 2 different tables at the same time.
I also would like to be able to reset/overwrite the information in 1 table, but add the information in the 2nd table when new information is entered.

Can someone provide me with some guidance, please

Dream
Last edited by dreamquartz on Sat May 04, 2019 11:57 pm, edited 1 time in total.
LO 7.x, HSQLDB 2.7.x & Ubuntu 22.04 LTS.
User avatar
keme
Volunteer
Posts: 3704
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: Store data simultaniously in 2 tables

Post by keme »

Dual (concurrent) registration of same data is usually a bad idea.

If the purpose is to enable some kind of "rollback", transaction handling may be for you.

If you need a "recent history", add a timestamp field and create a "recent" query filtering on the timestamp.

You could also use an update/reset query, transferring data from the 1st (data entry) table to the 2nd., clearing the 1st table as you transfer data. To show all entries, you can use a query like TABLE1 UNION (ALL) TABLE2.
eremmel
Posts: 1080
Joined: Tue Dec 30, 2008 1:15 am

Re: Store data simultaniously in 2 tables

Post by eremmel »

It will help when you specify your question at "requirement" level and not at technical implementation level. For many "Requirements" there exists default solution patterns. Keme is guessing in his response what your requirements are.

P.S.
A technical answer can be "Use Triggers" your favorite enemy.
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
dreamquartz
Posts: 881
Joined: Mon May 30, 2011 4:02 am

Re: Store data simultaniously in 2 tables

Post by dreamquartz »

eremmel wrote:It will help when you specify your question at "requirement" level and not at technical implementation level. For many "Requirements" there exists default solution patterns. Keme is guessing in his response what your requirements are.

P.S.
A technical answer can be "Use Triggers" your favorite enemy.
It's related :bravo:

It was a thought and could not find anything about it.

Dream
LO 7.x, HSQLDB 2.7.x & Ubuntu 22.04 LTS.
Post Reply