php - Count how many times a string appears in a mysql table -
i have big database stores data form. answers of form yes or no, in database there 62 names of questions stored answers (yes or no) , uid. need count how many times yes , no appears , store in variable. how can this? example of stored data this: tl1a->yes , tl2a->no , ..., uid->1234
just example ...
select *, round ( ( length(`yourfield`) - length( replace ( `yourfield`, "yes", "") ) ) / length("yes") ) count `yourtable`
in same manner "no"
hope work...
Comments
Post a Comment