简体   繁体   English

我如何在“ in”语句SQL中使用%

[英]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. 我想说的是,该事件是否包含“%webinar%”,“%network%”名称,如果日期在2015年1月4日之后,则将其包括在内。 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%')

please try 请试试

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

Try this way 试试这个

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

尝试这个。

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 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM