I have the following tables (and example values):
user: user_id (1, 2, 3) username (john33, reddiamond...) password (pass1, pass2...)
session: session_id (4,5, 6) user_id (1, 2, 3)
activity activity_id (1, 2) name (running, walking...)
user_activity user_activity_id (1, 2, 3, 4, 5) session_id (4, 5) activity_id (1, 2)
All columns with the same name are related. In the table user_activity there are rows which describe what is the session's activity and the activity reffers to users.
However I would like to get the table which describes what the user is currently doing:
result username(john33) activity.name(walking)
I would really appreciate if anyone could help composing the correct SQL statement to retrieve (generate) the result table.
(I'm using MSSQL).
Thanks!