Modified trigger query