Pivot / unpivot in SQL -
I have a view in SQL that I have created by analyzing values in tables so that values in that area ' N 'Ho , 'D' or 'V' can work with the sum of columns, but not by line ... is this possible? Example:
Data
No, call_1, col_2, col_3 1, n, n, n 2, n, d, d 3, N, V, D 4, V, V, V
How can I tell that line 3
the condition is quite simple but sadly I too I am!
Thank you very much, Peter
Select the case when col_1 = 'N' then ends as n_count from 1 and 0 tablename;
Normalize it:
Select the case when col_1 = 'N' then 1 and 0 end + case when col_2 = 'N' then 1 And the 0 end case when col_2 = 'N' then 1 and 0 end is in the form of n_count, case when col_1 = 'V' then 1 and 0 end + case when col_2 = 'V' then 1 and 0 end + case when Col_2 = 'V' will be 1 and 0 as the end v_count, .... from tablename;
Comments
Post a Comment