I was able to create my query by using Union
. However I am wondering if there is an easier way to create the same results? I've tried using in ('abc%','def%')
and like ('abc%','def%')
however I get a syntax error near the comma separating the two words in parenthesis.
Here is what I have so far...
select distinct a.case,a.person,a.personid,b.plans,a.code,a.action,cast(a.datea as date) as datea,cast(a.dateb as date) as dateb,a.updatecode
from table(nolock) a
inner join table(nolock) b on a.column=b.column
where updatecode = 'invalid'
and code like ('pr%') and datea >= '2016-09-16' and len (b.plans) = 16
union
select distinct a.case,a.person,a.personid,b.plans,a.code,a.action,cast(a.datea as date) as datea,cast(a.dateb as date) as dateb,a.updatecode
from table(nolock) a
inner join table(nolock) b on a.column=b.column
where updatecode = 'invalid'
and code like ('sea%') and datea >= '2016-09-16' and len (b.plans) = 16