Count number of records returned by a subquery in monetdb