Creating FirstRule SQLQuery