I am looking for an efficient way to convert rows to columns in SQL. Can the name of the column depend on the line change? Here is my example:
Name table films and Visitors
Id | film
0 | comedy
1 | horror
2 | drama
Id | visitors
0 | 3
1 | 10
2 | 4
0 | 8
1 | 5
2 | 1
I must current sum of comedy, drama, horror where the column names reflects the category of films currently in use. I don't know how.. Could you write this? Please