LIKE with IN/list of entries

Soldato
Joined
18 Oct 2002
Posts
6,785
Hi all,

I have a query whereby i need to return some entries from a table but the actual field is a string comprising other elements, such as a date. That means i need to do some sort of like, but also with an IN/list of entries. Having produced the script SQL Server Management Studio is telling me that the subquery is returning more than 1 record, which is true, but is there any way around this. See query below:

Code:
select ah.changedate, ah.ChangeDescription, ah.UserName, ad.Auditid, ad.sourcekey, ad.OldValue, ad.NewValue
from AuditDetail ad,
     auditheader ah
where ah.AuditId = ad.AuditId
AND ad.sourcekey like CONVERT(VARCHAR(20),(select distinct individualpolicyid from SplitBillingLink AS SB inner join Policy AS POL 
		on SB.EmployeeCategoryPolicyId = POL.PolicyId where PolicyStatus = 'L' and IndividualPolicyEffectiveDate = EffectiveDate)) + '~19%'
order by ad.Auditid

any help much appreciated.

Many thanks,

B@
 
Back
Top Bottom