I try to count how many times a value is in either column.
If the value is in both colums on the same row, it should only be counted as one.
| a | b
########################
1 | henrik | hans
2 | anne | henrik
3 | peter | finn
4 | henrik | henrik
5 | hans | anne
The count for ‘henrik’ should be 3.
I have tried to count and group, but without any succes.
Try this:
SQL Fiddle Demo.
This will give you: