문제

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 ...

도움이 되었습니까?

해결책

Try: group by instead of where.

select ((count(b)*10)/sum(a)) as AvgT from Kross group by b
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top