SQL Statement using Where clause with multiple values

前端 未结 3 726
盖世英雄少女心
盖世英雄少女心 2020-12-07 17:39

I have a table that has multiple rows with the following fields:

PersonName SongName Status

I want to use names selected from a multiple s

3条回答
  •  一整个雨季
    2020-12-07 18:10

    SELECT PersonName, songName, status
    FROM table
    WHERE name IN ('Holly', 'Ryan')
    

    If you are using parametrized Stored procedure:

    1. Pass in comma separated string
    2. Use special function to split comma separated string into table value variable
    3. Use INNER JOIN ON t.PersonName = newTable.PersonName using a table variable which contains passed in names

提交回复
热议问题