-2

I'm trying to build an SQL which if the case is positive then mark a custom object flag as 'true'

The issue is that in this created situation only one markup is made and then it is finished. I need to create an SQL in which a flag can be set more than once if the result is 'true'

select qr.email, qr.Name, qr.ContactId, qr.CreatedDate, Concat('55',qr.Phone) as phone, qr.LastName, qr.AccountId, qr.CPF, qr.OptIn, qr.RG, qr.IsPersonAccount,
        CASE WHEN ass.Empresa_Compra__c  LIKE '%Gipsy%'  THEN 'True' END AS Flag_Gipsyy,
        CASE WHEN ass.Empresa_Operadora__c  LIKE '%Guanabara%'  THEN 'True' END AS Flag_eGuanabara,
        CASE WHEN ass.Empresa_Operadora__c  = 'UTIL' THEN 'True' END AS Flag_Util,
        CASE WHEN ass.Empresa_Operadora__c  = 'REAL EXPRESSO' OR ass.Empresa_Operadora__c  = 'RAPIDO FEDERAL' THEN 'True' END AS [Flag_Real-Rapido],
        CASE WHEN ass.Empresa_Operadora__c  = 'SAMPAIO' THEN 'True' END AS Flag_Sampaio,
        row_number() over (partition by qr.Email order by qr.createdDate desc) validity2

this would be the piece of slq that makes the flag marking condition

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.