Creating somerule SQLQuery