zerg - 7 months ago 49

SQL Question

I have a table like this

`Day Operation Times Condition`

Monday addition 3 done

Monday subtraction 2 done

Monday subtraction 4 uncomplete

Tuesday multiplication 3 done

Tuesday addition 1 done

Tuesday addition 8 uncomplete

Wednesday subtraction 1 uncomplete

And I want to transform the Condition column in two distinct columns something like

`Day Operation Done Uncomplete Total`

Monday addition 3 0 3

Monday subtraction 2 4 6

Tuesday multiplication 3 0 3

Tuesday addition 1 8 9

Wednesday subtraction 0 1 1

Fusioning the Done and Uncomplete Operations in a single row

Is there a way to do it in SQL?

So far I have tried something like this Creating multiple columns from one column using case. I think than I may need to group it first by day, and then by Operation.

Answer

Considering the fact that you do this on Microsoft Access please refer to the following tutorial: https://www.youtube.com/watch?v=ZgerpTHzQes

Source (Stackoverflow)