【发布时间】:2021-03-27 12:50:27
【问题描述】:
我想选择所有没有特殊性或具有给定数组中的特殊性的约定。
约定
| convention_id | type |
|---|---|
| 1c | ty1 |
| 2c | ty2 |
| 3c | ty3 |
activity_type
| activity_type_id | effect_date | motif | fk_convention |
|---|---|---|---|
| 1a | xxxxx | nothi | 1c |
| 2a | xxxxx | abc | 1c |
| 3a | xxxxx | def | 2c |
| 4a | xxxxx | poi | 3c |
activity_type_specialties
| fk_activity_type | fk_specialty |
|---|---|
| 1a | 1s |
| 1a | 2s |
| 2a | 3s |
| 4a | 3s |
专业
| speciality_id | label |
|---|---|
| 1s | PEDIATRIE |
| 2s | GERIATRIE |
| 3s | NEPHROLOGIE |
对于数组 ['1s'],查询必须返回约定 1c 和 2c(约定 1c 包含特长 1s 和 2s,约定 2c 没有特长)
【问题讨论】:
-
还要指定预期的结果。 (minimal reproducible example.)
标签: sql join select left-join outer-join