SQL string manipulation [Get all text left of '(']

后端 未结 4 817
北恋
北恋 2021-01-02 09:08

I have some data which looks like so:

SourceOfBooking
----------------
Company1 (Foo)
Company2 (Bar)
Company3 (Foo1)
Company4 (Foo2)

I am l

4条回答
  •  长发绾君心
    2021-01-02 09:32

    You can;

    LEFT(SourceOfBooking, CHARINDEX(' (', SourceOfBooking + ' (') - 1)
    

    (Remove + ' (' if needed; it allows for rows with no  (

提交回复
热议问题