I want to count the number of times for example data 'a' occurs from all the table below that from column d1,d2 and d3. For example here the number of times 'a' occurs from the table is 3.\[code\]d1| d2 | d3 |-------------a| ab | a |a| ab | ab|ab| av | ac |zx| cx | zz|\[/code\]I use \[code\]SELECT SUM(d1='a') + SUM(d2='a') + SUM(d3='a') FROM my_table\[/code\]and \[code\] $result = mysql_query($sql);$row = mysql_fetch_assoc($result); $allsum = $result[0];echo '<pre>'; echo $allsum; echo '</pre>';\[/code\]but the echo does not workthnk for any solutions.