Question
I have a doubt regarding MySQL. I have a table where it has some columns. I have to make a calculation to each entry using the entry itself. presently I am kind of using the following way for each entry ...
select ((count(b)*10)/sum(a)) as AvgT from Kross where b = 'ABC';
Is there anyway to do it for all the entries without using WHERE??? May be using a loop for every entry in the column b or something like that ...
Solution
Try: group by
instead of where
.
select ((count(b)*10)/sum(a)) as AvgT from Kross group by b
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow