Multiple In  Statement

Posted on 2011-10-04
Last Modified: 2012-05-12
I have 2 fields ... Branch and Salesperson... Can i write an In Statement to resemble this??

Branch in ('11') and Salesperson ('123') then 'Field3'... I tried a Case When, then statement and I couldnt get it to work.. Any ideas?
Question by:Mikeyman_01
    1 Comment
    LVL 22

    Accepted Solution


    I'm not sure I understand. Are you looking for this:

    SELECT CASE WHEN Branch='11' AND Salesperson='123' THEN 'Field3' END
    FROM yourtable

    or if you really like IN

    SELECT CASE WHEN Branch IN ('11') AND Salesperson IN ('123') THEN 'Field3' END
    FROM yourtable

    Otherwise perhaps you could give some more details.


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
    Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    729 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

    17 Experts available now in Live!

    Get 1:1 Help Now