I have a set of data, each point either starts with a AB
, PO
, or LV
. there are also a number of entries with things I don't want like MC
or BV
. I also have some dates, it looks like this.
Select distinct clm.Theletter, clm.thenotedate, clm.theorigdate
from table.table
where clm.thenotedate>= ''2018-01-21'' and clm.theorigdate>''2018-01-01''
and clm.Theletter_NUM LIKE ''HP%''
order by clm.thenotedate asc
);
and I get a list of everything I want that starts with AB
, but I also want the stuff that starts with PO
and LV
? I tried using OR after my first LIKE but it seems to ignore the date functions and retrieve everything before 2018-01-01 that starts with PO
and LV
, which is a lot.
It is probably simplest if you do:
. . . and
left(clm.Theletter_NUM, 2) in ('AB', 'PO', 'LV')
Most databases support a left()
function on strings. If not, just use the appropriate substring function.