When is it okay to have sex after having a baby?

Do you have to wait for 6 weeks or can you do it sooner?