다른 값을 기반으로하는 값을 가져 오는 원시 SQL 쿼리에 대한 도움이 필요합니다.MySQL - 두 조인 결과를 병합
다음 원시 SQL 쿼리가 있습니다. 나는 모두 pmPropShort.str 및 pmPropLong.str을 얻고있다
+----+------+-------+------+------+
| id | name | units | str | str |
+----+------+-------+------+------+
| 14 | Area | mm2 | 1.1 | NULL |
+----+------+-------+------+------+
문제를 내가 하나 또는 다른 베팅해야합니다
SELECT pmPropDef.id, pmPropDef.name, pmPropDef.units, pmPropShort.str, pmPropLong.str
FROM pmProp INNER JOIN pmPropDef ON pmProp.propid=pmPropDef.id AND pmPropDef.name = 'Area'
LEFT JOIN pmPropShort ON sid=pmProp.value
LEFT JOIN pmPropLong ON lid=-pmProp.value
WHERE pmProp.ownertype='variant' AND pmPropDef.id = pmProp.propid;
는 그리고 이것은 다음과 같은 결과. 내가 원한 것은 단일 str 값이다. 필요에 맞게이 쿼리를 어떻게 다시 작성합니까?
입니다 e.g.'AS는 굉장 –
는 str'! 정말 고마워! – rh0dium