Orgasm

I can easily achieve orgasm on my own by just squeezing my legs together and stuff but I can never have an orgasm when having sex... Why is this? And how can I fix that?