Replace mysql formula