select * from Customers WHERE Name AND Surname in ('Peter,Pan','Roger,Rabbit','Captain,Hook')

Posted on 2006-03-24
Last Modified: 2012-06-21
i've got a Customers Table with Fields Name,SurName
How can i write a query selecting multiple names and surnames e,g.
select * from Customers WHERE Name AND Surname in ('Peter,Pan','Roger,Rabbit','Captain,Hook')

thank you!
Question by:jxharding
    LVL 75

    Expert Comment

    by:Aneesh Retnakaran
    select * from Customers WHERE Name IN ('Peter,Pan','Roger,Rabbit','Captain,Hook') or  Surname in ('Peter,Pan','Roger,Rabbit','Captain,Hook')

    LVL 14

    Assisted Solution

    try this

    select * from Customers WHERE Name + ',' + Surname in ('Peter,Pan','Roger,Rabbit','Captain,Hook')
    LVL 75

    Accepted Solution

    select * from Customers WHERE REPLACE(Name + ',' + Surname,' ','') in ('Peter,Pan','Roger,Rabbit','Captain,Hoo<wbr/>k')
    LVL 50

    Expert Comment


    select * from Customers
     WHERE (Name = 'Peter' AND Surname ='Pan')
      or (Name = 'Roger' and Surname = 'Rabbit')
      or (Name = 'Captain' and surname = 'Hook')

    should be more efficient

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    I recently came across an interesting Question In EE ( and was puzzled about how to achieve that using SSIS out of the box tasks, which was i…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now