query with command behavior