Is it possible to switch queries based on an input in mySQL?
This should be possible with basic logical operations (IF, THEN, ELSE etc)

In this situation you'd want to get the INPUT value and check it against your conditions (pseudocode):

IF INPUT = 'YEARLY' THEN
BEGIN
INSERT QUERY HERE
END
END IF

IF INPUT = 'MONTHLY' THEN
BEGIN
INSERT QUERY HERE
END
END IF


For more information on this check the manual:

https://dev.mysql.com/doc/refman/5.7/en/if.html