Add correlated query

Signed-off-by: Mingxi Wu <thisisforivy@gmail.com>