One method is to set the engineering quantity as 1, and then1(1/6-1/8) = 24.
There's another way.
Drain water for 6 hours, drain water for 8 hours, and the minimum common multiple of 6 and 8 can be set to 24.
Then the working efficiency of the two is 24/6 = 4 and 24/8 = 3 respectively.
Time =24/(4-3)=24 hours