두 개의 간단한 SELECT 문이 있습니다. 첫 번째는 기능 목록을 표시합니다.Transact SQL - 사용할 가입
SELECT * FROM Features
id name
-- ----
1 24 Hour Access
2 24 hour CCTV monitoring
3 Airport location
4 Break-Out Areas
5 Business Lounge
6 Business park location
snip..
두 번째 문은
SELECT
*
FROM
#SmartFeaturesToUpdate new_features
ORDER BY
new_features.centre_translation_id,
new_features.feature_id,
new_features.feature_selected
feature_id centre_translation_id feature_selected
---------- --------------------- ----------------
1 1 1
2 1 1
5 1 1
10 1 1
11 1 1
snip..
내가보고 싶은 것은 센터 번역에 의해 모든 기능이다
을 변경 기능 정보의 목록을 보여줍니다. 테이블을 결합 저를 제공합니다SELECT
*
FROM
#SmartFeaturesToUpdate new_features
LEFT JOIN Feature feature ON feature.id = new_features.feature_id
ORDER BY
new_features.centre_translation_id,
new_features.feature_id,
new_features.feature_selected
feature_id centre_translation_id feature_selected id name
---------- --------------------- ---------------- -- ----
1 1 1 1 24 Hour Access
2 1 1 2 24 hour CCTV monitoring
5 1 1 5 Business Lounge
10 1 1 10 Double Glazing
11 1 1 11 Elevator
snip..
위없는 결과 기능 ID의 3, 4, 그들은 두 번째 목록에없는 때문이다. 하지만 내가 필요로하는 결과는 다음과 같습니다
feature_id centre_translation_id feature_selected id name
---------- --------------------- ---------------- -- ----
1 1 1 1 24 Hour Access
2 1 1 2 24 hour CCTV monitoring
3 1 1 3 Airport Location
4 1 1 4 Break-Out Area
5 1 1 5 Business Lounge
snip..
어떻게이 acheive과 기능 모두에서 결과를 결합하는 세 번째 SELECT 문을 수정 및 정보 목록을 특징으로한다? 코멘트가 언급으로
차이점과 달성하고자하는 단어로 설명해 주시겠습니까? 예제는 훌륭하지만 몇 단어 migth 도움이됩니다. – Eggplant
"Break-Out Area"에 대한 centre_translation_id 및 feature_selected 열의 값은 어디서 얻습니까? – openshac
업데이트 되었습니까? – NiceYellowEgg