In this paper, we present a discriminative learning method to improve the consistency in phrase-based Statistical Machine Translation (SMT). Our method is inspired by Translation Memory (TM) systems which are widely used by human post-editors in industrial setting. We constrain the translation of an input sentence using its most similar `translation example' retrieved from the training data. Differently from previous research, these constraints are imposed using discriminative learning to optimise the translation performance. We observe that using this method can benefit the SMT system by not only producing consistent translations but also improved translations outputs.