I am trying to remove the "s" from the word "years" when the COUNT() is < 2 but my syntax is not right for some reason:
Errors: Incorrect syntax near the keyword 'IF'. Incorrect syntax near the keyword 'convert'.
stuff(
(
select ',' + Related_name + ' (' + (select
IF COUNT(begin_date) > 1 BEGIN convert(varchar(10), COUNT(begin_date)) + ' years)' END
ELSE BEGIN convert(varchar(10), COUNT(begin_date)) + ' year)'
from cus_relationship subInnerR
where subInnerR.master_customer_id = c.master_customer_id
and subInnerR.related_master_customer_id = innerR.related_master_customer_id
and subInnerR.relationship_type = 'ADVSPR'
and subInnerR.relationship_code = 'CLUB'
and subInnerR.reciprocal_code = 'FACADV')
from cus_relationship innerR
where [...]