Reputation: 3616
I had 2 tables:
workers: id, user_id, group_id, name, ...
worker_groups: id, name, ...
The "group_id" is the relation with worker_groups. This was a fixed relation. Now, my task is, to change the group_id in specific dates. So, i made a 3rd table:
relation: id, w_id, wg_id, start_date
It's a huge project, and i need a solution to return the group_id for the desired worker on current days. My old query:
SELECT id, name, group_id FROM workers
WHERE user_id = 1;
I don't want to change my old query, is there any solution, to map "group_id" cell with a query/function/procedure or view to return the present "group_id" from the relation table? Or the only solution is to edit my query and make the function call from it?
SOLUTION
The desired resolution was achieved by renaming the old table, and creating a view with the old table name. I must change the table name in edit/add functions, but at least this could be done quickly
Upvotes: 1
Views: 136
Reputation: 3616
The desired resolution was achieved by renaming the old table, and creating a view with the old table name. I must change the table name in edit/add functions, but at least this could be done quickly
Upvotes: 1