Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3570

CASE WHEN equivalent in SQLSCRIPT

$
0
0

Hello everybody,

 

I am new to this forum, maybe somebody can help me

 

At it's core, I want to create a calculation view that calculates count() of different values for one column

 

in SQL, I was able to solve the problem with the following code:

 

SELECT"Id", count(casewhen"TA_TYPE"='StrongPositiveSentiment'then 1 end) as"SPS",

count(casewhen"TA_TYPE"='WeakPositiveSentiment'then 1 end) as"WPS",

count(casewhen"TA_TYPE"='Sentiment'then 1 end) as"S",

count(casewhen"TA_TYPE"='WeakNegativeSentiment'then 1 end) as"WNS",

count(casewhen"TA_TYPE"='StrongNegativeSentiment'then 1 end) as"SNS"

FROM"GBI_011"."$TA_GRUPPE_3_ENGLISH_IDX"

GROUPBY"Id"


The corresponding output looks like this:


hana.PNG



Now, I want to create the same in a calculation view with SQLScript, but it seems the same code doesnt work there. I want to group by "Id" and get the count() values for different entries in "TA_TYPE", e.g Sentiment, WeakPositiveSentiment etc... in the calculation view


any suggestions? I hope I made my problem clear


Greetings

Daniel



Viewing all articles
Browse latest Browse all 3570

Trending Articles