String split column and join to another table

后端 未结 3 1777
情话喂你
情话喂你 2021-01-02 02:08

Let\'s say I have 2 tables like this :

Job Offers:

+----+------------+------------+
| ID |    Name    | Categories |
+----+--------         


        
3条回答
  •  我在风中等你
    2021-01-02 02:34

    From SQL SERVER 2016 we can use sql inbuilt function STRING_SPLIT as below :

    SELECT * FROM JobOffers as j 
    outer apply STRING_SPLIT(j.[Categories], ',') s
    left join dbo.Categories as c on c.CategoryID =s.value
    

提交回复
热议问题