我很难过,我不知道如何使用多个不同的标识符在表上获取结果,然后对结果进行分组
这是我的表ProjectFieldValue简而言之
id | project_id | textValue | dateValue | fieldKey
================================================================
1 | 1000 | Closed | NULL | contract_status
================================================================
2 | 1000 | NULL | 2019-05-01 | closing_date
================================================================
3 | 1001 | Open | NULL | contract_status
================================================================
4 | 1001 | NULL | 2019-05-22 | closing_date
================================================================
5 | 1002 | Closed | NULL | contract_status
================================================================
6 | 1002 | NULL | 2019-05-11 | closing_date
================================================================
7 | 1003 | Closed | NULL | contract_status
================================================================
8 | 1003 | NULL | 2019-05-24 | closing_date
================================================================
我需要运行查询以获取所有记录...
“contact_status”的fieldKey和“Open”的fieldKey的textValue
“close_date”的fieldKey和2019-05-01 AND 2019-05-30之间的dateValue
这是我尝试过的,我只是得到一个空白的查询结果集
select pfv.*
from ProjectFieldValue pfv
where (pfv.dateValue between '2019-05-01' AND '2019-05-30' AND pfv.fieldKey = 'closing_date')
AND (pfv.textValue = 'Closed' AND pfv.fieldKey = 'contract_status')
慕村225694
慕婉清6462132