set discount sql condition