Emir Cabukoglu Emir Cabukoglu - 1 year ago 75
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)


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