How did water get to earth?

back in time how did water land here? i mean if earth was created it was prob covered in lava and crap, so when everything dried how did water get here? and if say i dont know comets or meteros crashed here bringing water how did they get it?
9 answers 9