Skip to content
Advertisement

Query returns multiple id’s

I have a query that finds the most frequent numbers in multiple columns (named S1, S2, S3, S4, S5 and S6. The query seems to be working pretty good, but it doesn’t count the total number per id in the columns.

Here’s the query:

The query above returns f.e.

Tag 37 (Robin Johansson) total value should be ’21’ and tag 28 Sebastian Borgs total value should be ’17’ etc.

I’ve tried to GROUP BY spelarid and tag, but it doesn’t add up the total number.

Advertisement

Answer

You can unpivot and count. I think you want something like this:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement