Relative height or height from ground? Ok so I encountered this question ->  

A 10 H.P. motor pumps out water from a well of depth 20m 
  and fills a water tank of volume 22380 litres at a height of 10m 
  from the ground. The running time of the motor to fill the 
  empty water tank is (g = 10ms−2 )

Upon solving this my answer came out to be 15 minutes while the answer in the book is 5min. The book takes the height to be "10m" which is the height from the ground.
My question is do we take the height from the ground or do we take net height because potential energy is relative to height isn't it? If height is relative then shouldn't the total height be 30metres?  If the given answer is correct won't it mean that there is ZERO work done in bringing water from the underground no matter how deep it is?
 A: I agree with JMac's comment that the question is highly ambiguous and cannot be answered definitively. Perhaps the required context or assumptions are provided by the previous sections in the textbook.
If the water level in the well remains 20m below ground level while water is pumped out, and that of the tank at 10m above, then every litre of water is raised through a height of 30m. The same reasoning applies if the water is initially at ground level and the depth of water in the well is 20m. Judging by the answer, perhaps the key insight is that the reservoir of water below ground is so vast that the level of water in the well is not affected by removing 22380 litres. This also assumes that the rate at which water is removed is less that the rate at which it can seep back into the well through its walls and base. 
However, if the level of water in the well and/or the storage tank changes, then the calculation is not so straightforward. You can only decide if this is the case from the situation described in the question. If the situation is not described adequately in the question or its context, then there is no way of knowing what the author intended. 
A: When solving problems in potential energy of the earth mass system, we take an appropriate reference point. We assume the potential energy and height at this reference point to be 0. You can take the reference point anywhere you want.
In your specific question, if we take reference point on the ground, the height of water tank is 10m, the height of well is -20m. Total difference in 10-(-20)=30m.
If you take the reference point at the bottom of the well, the height of water tank is 30m and that of well is 0m. The difference is 30-0=30m. Therefore the result remains unaffected. And for the answer, I think your solution is correct. Your textbook may be wrong.
