[Closed] Calculate Column value from other table without Primary Key/Unique | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[Closed] Calculate Column value from other table without Primary Key/Unique

I have two tables: One with the names, ID etc. from the users called USERS. The other one contains only times for every user (columns: ID (primary key, foreign key) MONDAY, TUESDAY and TIME_WEEK). TIME_WEEK is calculated with summing MONDAY and TUESDAY. My problem is that I want to save the TIME_WEEK from the second table also in the first table. But I can't make TIME_WEEK unique or a primary key because several users could have the same time. How can I get the value from the second table and save it in the first table? Thanks in advance!

3rd Jan 2020, 11:42 AM
Sebastian Thomas
Sebastian Thomas - avatar
3 Answers
+ 2
Of course I've also Wednesday and so on. I think I don't need the whole working time alsolutely in the first table... Thank you anyway
5th Jan 2020, 8:56 AM
Sebastian Thomas
Sebastian Thomas - avatar
+ 1
Are MONDAY, TUESDAY and TIME_WEEK storing work hours? but then why name it TIME_WEEK when it only record two days work hours (monday and tuesday). Also I don't understand the need for this TIME_WEEK field in the first table 'USERS'. Can you elaborate some more on what you are trying to achieve by these data?. Hope you may gain better response given more details included 👍
4th Jan 2020, 5:02 PM
Ipang
0
If this case is solved you may close the question by editing your title like so; "[CLOSED] Calculate Column value from other table without Primary Key/Unique" That way other people will be informed thus will not post an answer. (Edit) Thank you for updating the post Sebastian 👍
5th Jan 2020, 10:25 AM
Ipang