Creating secondrule SQLQuery