<commit_before>﻿CREATE PROCEDURE [employer_account].[GetAccountStats]
	@accountId BIGINT = 0	
AS
	SELECT	MAX(acc.Id) as AccountId,
			COUNT(DISTINCT his.Id) as PayeSchemeCount, 
			COUNT(DISTINCT ag.Id) as OrganisationCount, 
			COUNT(DISTINCT mem.UserId) as TeamMemberCount 
	FROM [employer_account].[Account] acc
	INNER JOIN [employer_account].[AccountHistory] his ON acc.Id = his.AccountId
	INNER JOIN [employer_account].[EmployerAgreement] ag ON acc.Id = ag.AccountId
	INNER JOIN [employer_account].[Membership] mem ON acc.id = mem.AccountId
	WHERE acc.Id = @accountId
	GROUP BY acc.Id<commit_msg>AML-2153 Optimised GetAccountStats sproc<commit_after>﻿CREATE PROCEDURE [employer_account].[GetAccountStats]
	@accountId BIGINT = 0	
AS
	SELECT
		(SELECT @accountId) AS AccountId,
		(SELECT COUNT(1) FROM [employer_account].[AccountHistory] WHERE AccountId = @accountId) AS PayeSchemeCount,
		(SELECT COUNT(1) FROM [employer_account].[EmployerAgreement] WHERE AccountId = @accountId) AS OrganisationCount,
		(SELECT COUNT(1) FROM [employer_account].[Membership] WHERE AccountId = @accountId) AS TeamMemberCount
{'fraction_non_alphanumeric': 0.0990990990990991, 'fraction_numerical': 0.008108108108108109, 'mean_word_length': 6.076433121019108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5714110', 'n_tokens_mistral': 410, 'n_tokens_neox': 356, 'n_words': 94}