query conversion