-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsomething.sql
More file actions
35 lines (34 loc) · 778 Bytes
/
something.sql
File metadata and controls
35 lines (34 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* relevant users for a given context code */
SELECT
user_data AS userData
FROM
norm.tb_user u
JOIN norm.tb_user_context uc ON u.network_id = uc.network_id
AND u.user_code = uc.user_code
AND uc.context_id = (
SELECT
context_id
FROM
norm.tb_context
WHERE
context_code = 'age-training'
)
LIMIT
5;
/* relevant messages for a given context code */
SELECT
msg_data AS msgData
FROM
norm.tb_message m
JOIN norm.tb_user_context uc ON m.network_id = uc.network_id
AND m.msg_code = uc.relevant_msg_code
AND uc.context_id = (
SELECT
context_id
FROM
norm.tb_context
WHERE
context_code = 'age-training'
)
LIMIT
5;