I am trying to count the amount of times an int or string value is presented in a table row from several columns in a non-normalized table.
SELECT count(*) from persons
WHERE ‘1’ IN (column 1
, column 2
, column 3
,column 4
) AND person_MyId=’14′;
what I trying to solve is if its possible to count the amount of times the value of 1 was located in the 4 columns WITHOUT normalizing that table? trying to see what I am missing in my query to pull that off,
2
Answers
Use query:
Use SUM,
See example