Selecting on aggregate column without alias generates code that doesn't compile


#1

This query produces code in ISU that doesn’t compile:

	<query name="DuplicateSsoUsernames">
		<selectFromClause>
			SELECT ur.SsoUsername, iptur.IdentityProviderId, COUNT(*) 
			FROM UserRecord ur
			JOIN IdentityProvidersToUserRecords iptur ON ur.Username = iptur.Username
			GROUP BY ur.SsoUsername, iptur.IdentityProviderId
			HAVING COUNT(*) > 1
		</selectFromClause>
		<postSelectFromClauses>
			<postSelectFromClause name="All"></postSelectFromClause>
		</postSelectFromClauses>
	</query>

it wasn’t until I added as Count after COUNT(*) at the beginning of the statement that it generated correct code.