सक्षम नहीं करने के लिए जुटना मूल्यों के आधार पर अलग-अलग कॉलम, जब मामले में, बयान -हिमपात का एक खंड

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

धन्यवाद, अरुण

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

धन्यवाद @Felipe!...हाँ, मैं स्वीकार किए जाते हैं जवाब...
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ý
..................................................................................................................

इस श्रेणी में लोकप्रिय

लोकप्रिय सवाल इस श्रेणी में