Answer the question
In order to leave comments, you need to log in
How to store the chronology of an event?
Good evening. I am faced with such a task, and I do not know how to solve it correctly:
We have 3 different tables: information about the replenishment of money, information about the withdrawal of money, information about the use of promotional codes. They all have different fields, they all have a Date field but no Description field. I need to make a chronology of events.
So, my question is: how to make this chronology?
I came up with 3 options:
Answer the question
In order to leave comments, you need to log in
Max speaks the matter, but if the structure is not changed, do not take out such operations on the client - you will be very slow in speed.
Make a view that combines all tables with the minimum required data and sort by date.
Description is added like this:
select date, price, 'table 1' as desc from table1
UNION ALL
select date, price, 'table 2' as desc from table2
UNION ALL
select date, price, 'table 3' as desc from table3
in general, I would write this in 1 table "financial transactions", highlighting the type of event (write-off-replenishment). Promotional codes are the same account replenishment, but of a special type. But promotional codes, their "nominal value", expiration date, valid / redeemed should be stored separately
and processed in the database - unequivocally. And choose only what you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question