할 수 없을 연결하는 값에 따라 서로 다른 열 경우에 문 눈

0

질문

희망을 하고 있습니다...내가 노력하고 값을 연결하의 경우에 따라 문을 다른 열에 눈송이시 찾 블록의 코드는 아래

select *,

case when checkouttime is null then ',Patient is not checked out' else '' END
+ case when primarypatientinsuranceid is null then ',No insurance information' else '' END
+ case when closedby is null then ',Encounter not signed off' else '' END
+ case when billingtabcheckeddate is null then ',Billing tab is not checked' else '' 
+ case when alreadyrouted is null then ',Missing slip already routed' else 'Valid Missing slip'

END as resultant

from final

나는 오류를 말하는"예상치 못한으로"

나을 구축을 위해 노력하고 결과 열출력으로 다음

Patient is not checked out/Billing tab is not checked
Missing slip already routed
Encounter not signed off/No insurance information /Billing tab is not checked
Valid Missing slip

감사합니다, Arun

case snowflake-cloud-data-platform
2021-11-16 08:52:58
2

최고의 응답

1

깨끗한 대안을 추가하는 쉼표로,필요 사용 array_to_string(array_construct_compact()):

with data as (
    select null checkouttime
        , 2 primarypatientinsuranceid
        , null closedby
        , 4 billingtabcheckeddate
        , 5 alreadyrouted
)

select array_to_string(array_construct_compact(
    iff(checkouttime is null, 'Patient is not checked out', null) 
    , iff(primarypatientinsuranceid is null, 'No insurance information', null)
    , iff(closedby is null, 'Encounter not signed off', null)
    , iff(billingtabcheckeddate is null, 'Billing tab is not checked', null)
    , iff(alreadyrouted is null, 'Missing slip already routed', 'Valid Missing slip')
    ), ',  ')
as resultant
from data
2021-11-16 21:53:34

감사@Felipe...이것은 정말 도움이 됩니다!
user3369545

십시오 받아들이 대답하는 경우 그 대답을 원하는:)
Felipe Hoffa

감사@펠리페!...예 승인을 받았다.
user3369545
1

에 눈송이를 사용하여"||"concat 문자열이 아닌"+":

select 
case when true then ',Patient is not checked out' else '' END
|| case when false then ',No insurance information' else '' END
|| case when true then ',Encounter not signed off' else '' END
|| case when true then ',Billing tab is not checked' else '' END
|| case when false then ',Missing slip already routed' else 'Valid Missing slip' END 
as resultant;

https://docs.snowflake.com/en/sql-reference/functions/concat.html

2021-11-16 11:33:34

감사@에릭 린..이것은 정말 도움이 될 것입니다....할 수 있 알려주시기 바랍를 제거하는 방법 첫 번째 문자로 오는 쉼표
user3369545

죄송할 수 있으십니까? 지 않아요 완전히 이해 당신은 위의 질문입니다.
Eric Lin

안녕하세요 에릭....에서 출력 결과를 얻을 쉼표로서 기나긴 여정을 시작합니다.요구되었으로 제거하는 방법의 쉼표...
user3369545

그것이 있었기 때문에","에,환자가 확인되지 않는'나는?
Eric Lin

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................