So I need to calculate the amount of Clients who's LastName start with the same letter, then use that count as part of an Reference number.
I.e. something like this:
declare @AmountOfSimilarSurnames int; set @AmountOfSimilarSurnames = (...) declare @Ref nvarchar(100); set @Ref = 'CLT00' + @AmountOfSimilarSurnames
I need help setting that
So far I got this but it is working:
select COUNT(*) FROM Client c1 join Client c2 on RIGHT(c1.Client_LName,1) = RIGHT(c2.Client_LName,1)