Emir Cabukoglu Emir Cabukoglu - 2 years ago 101
SQL Question

SQL database averaging a value for distinct people

enter image description here

I would like to average the weights which can be seen in the picture.
That means the calculation I want to make is : (50+65+70+68+70)/5
Do you know how to do that? (to specifically select the weights ones for every person using the household number and person number)

Answer Source

Seem you want to average the distinct weights per household:

   SELECT DISTINCT HouseHoldNumber, Weight -- maybe need to add TravelNumber or PersonNumber
   FROM tab
 ) AS dt
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download