Results 1 to 3 of 3

Can anyone help with SQL?

Threaded View

  1. #1
    Registered User
    Join Date
    01-28-2015
    Location
    Tampa, FL
    MS-Off Ver
    2010
    Posts
    110

    Can anyone help with SQL?

    I wasn't sure if anyone on this forum had any experience with SQL and I have found this forum users to be extremely knowledgeable so I figured I would try and ask anyway.

    I have a data table that lists customers and contains a row for every product the customer has. So a customer can have one row if they only have one product but can have 3 rows if they have three distinct products.

    ex.
    Customer Name		PRODID
    Customer 1		20200B
    Customer 1		20700A
    Customer 1		304Z
    Customer 2		20200B
    Customer 2		20700A
    Customer 3		304Z
    I am trying to add an "AND" condition to my "Where" clause that will have the query list the customer rows where customers have product 1, 2 and 3. If a customer has only one of those products or any other combination I don't want to see them. I only want to see that combination only. In the example above, I would only expect Customer 1 to populate.

    I tried writing the "AND" condition to say .... "and (P1.PRODID in (20200B,20700A) and (P1.PRODID = '304Z')) but no rows generate.

    Is anyone able to assist and advise what I may be doing wrong?
    Last edited by 6StringJazzer; 08-29-2024 at 02:12 PM. Reason: fixed data formatting

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1