The second expression in your question will always lead to the execution of @ test2 = 'testelse' , because ELSE ends immediately after the first expression after else:
IF ((SELECT COUNT(*) FROM table WHERE table.Date > '2016-03-20') > 10) SET @test1 = 'test1' ELSE SET @test1 = 'testelse'
If you have multiple expressions inside an IF, you can always group expressions using BEGIN / END.
But in your case, the simplest way would be the following:
IF (SELECT COUNT(*) FROM table WHERE table.Date > '2016-03-20') > 10 SELECT @test1 = 'test1', @test2 = 'test2' ELSE SELECT @test1 = 'testelse', @test2 = 'testelse'
source share