Run query to database query rulesys