I'm having trouble with this SQL:
$sql = mysql_query("SELECT $menucompare ,
(COUNT($menucompare ) * 100 / (SELECT COUNT( $menucompare )
FROM data WHERE $ww = $button )) AS percentday FROM data WHERE $ww >0 ");
$menucompareis table fields names what ever field is selected and contains data bellow$buttonis the week number selected (lets say week '6')$wwtable field name with row who have the number of week '6'
For example, I have data in $menucompare like that:
123456bool
521478bool
122555heel
147788itoo
and I want to select those, who have same word in the last of the data and make percentage.
The output should be like that:
- bool --
50%(2 entries) - heel --
25%(1 entry) - itoo --
25%(1 entry)
Any clearness to my SQL will be very appreciated. I didn't find anything like that around.