title: SQL Where IN CLAUSE Variable
body: <p>I have a process where I basically have to go through a spreadsheet and look up individuals name by name on an internal system by name/surname and DOB and then retrieve the setting in what they attend.</p>
  <p>I have been given access to the database and I have previous experience with SQL but nothing extensive. I have put dummy names for my tables as below just because it can contain sensitive information.</p>
  <p>I want to know if there is anyway I can do this in an easier way, I will eventually be connecting to the db via VBA and retrieving the data this way. I don't know if I could insert a variable into the IN Clause and create a custom function which create a variable which will return something like 'Bob','Keith' etc  it so it can be passed into SQL (hopefully that makes sense). Also, are you able to pass abbreviated table names if you are passing the SQL through VBA?</p>
  <p>Also I am not sure if it is possible so that the setting is returned on the correct rows or its best to use some lookup function on multiple criteria?</p>
  <p>It isn't a great way of doing things I know but its the only way as each person doesnt have a unique identifier in the data I initially receive.</p>
  <pre><code>SELECT  p.Forename
        ,p.Surname
        ,p.Birth_Date
        ,p.xxx
        ,p.xxx
        ,csc.name
        ,cs.name2 
  FROM dbo.Person AS P
  INNER JOIN dbo.banana AS csc ON csc.xxx = p.xxx
  INNER JOIN dbo.apple AS cs ON cs.xxx = p.xxx
  WHERE p.forename IN('xxx', 'xxx', 'xxx', 'xxx')
    AND p.surname IN('xx','xx','xx', 'xx')
    AND p.Birth_Date IN(N'xx', N'xxx', N'xxx', N'xxx')
  
  </code></pre>