Is it possible to use LIKE and IN for a WHERE statment?

后端 未结 4 1689
后悔当初
后悔当初 2020-12-06 17:47

I have a list of place names and would like to match them to records in a sql database the problem is the properties have reference numbers after there name. eg. \'Ballymena

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 18:18

    well a simple solution would be using regular expression not sure how it's done in sql but probably something similiar to this

    WHERE dbo.[Places].[Name]  SIMILAR TO '(Banger|Ballymena)';
    

    or

    WHERE dbo.[Places].[Name] REGEXP_LIKE(dbo.[Places].[Name],'(Banger|Ballymena)');
    

    one of them should atleast work

提交回复
热议问题