COUNT with scalar fields support in query