Master Table
nID Elementtype elementval
1 volume 5
1 rating +
1 volume 3
1 rating -
2 volume 2
2 rating *
2 volume 4
2 rating +
3 volume 3
3 rating +
client table
nID client
1 halkins
2 narnia
3 avatar
4 narnia
5 newsco
6 halkins
How do I get the average of volume and sum of rating of three types clientwise,For example for halkins
client No(sum) volumeavg ngve potve neutral
halkins 4 4 1 1 0
how to get the other values basically volumeavg in the same query
or is their any other approach Volume is average of volumes, for halkins 5+3/2=4
You need to join the tables, then group the results:
See it on sqlfiddle.