yoda
yoda

Reputation: 121

how can i use % in an "in" statement SQL

I'm trying to say if the event has '%webinar%','%network%' in the name include it "if" the date is after the 01-04-2015. I cant use "or" on a separate line as it ignores the date. Any help appreciated.

select 
    ,fsa.eventid
    ,sev.EventStart
    from
    event sev
    on 
    sev.eventId = fsa.eventid
    where sev.SNAP_EventStart >= '2015-04-01'
    and eventidname in ('%webinar%','%network%')

Upvotes: 0

Views: 103

Answers (3)

Christian Delos Reyes
Christian Delos Reyes

Reputation: 28

Try this.

select ,fsa.eventid ,sev.EventStart from event sev on sev.eventId = fsa.eventid where sev.SNAP_EventStart >= '2015-04-01' and
( Patindex('%webinar%', eventidname) = 1 OR Patindex('%network%', eventidname) = 1 )

Upvotes: -1

Mukesh Kalgude
Mukesh Kalgude

Reputation: 4844

Try this way

SELECT  * 
FROM    table t INNER JOIN
        (
            SELECT  '%webinar%' Col
            UNION SELECT '%network%' col
        ) a ON t.COLUMN LIKE a.Col

Upvotes: 0

Pirvu Georgian
Pirvu Georgian

Reputation: 691

please try

... where sev.SNAP_EventStart >= '2015-04-01'
    and (eventidname like '%webinar%' or eventidname like '%network%')

Upvotes: 2

Related Questions