Jump to content

lusercfc

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by lusercfc

  1. This is TimesTen which I'm not really familiar with but it's a flavour of SQL...

     

    Think of column_two as a userID and column_three as services they have purchased... so one user may have purchased many items. 

     

    What I need to do is find all the users who have purchased services 3 *and* 12... if they've also purchased more (68, 76 etc) thats OK but I need to exclude them if they've purchased 3 *or* 12 (but not both)

     

    Here's how I can list all the services (column_three) they have purchased

    Command> SELECT * FROM table WHERE column_two = 299993025;
    < 234563210, 299993025, 3, N >
    < 247146769, 299993025, 12, Y >
    < 261197904, 299993025, 68, N >
    < 266960384, 299993025, 76, Y >
    < 265304246, 299993025, 84, N >
    < 248300956, 299993025, 87, Y >
    < 231784018, 299993025, 88, Y >
    < 201720976, 299993025, 90, Y >
    8 rows found.

    I modified the query as follows but it doesn't find anything.

    Command> SELECT * FROM table WHERE column_2 = 299993025 AND (column_3 = 3 AND column_3 = 12);
    0 rows found.
    

    For what it's worth, just having one column_3 item queried does work

    Command> SELECT * FROM table WHERE column_2 = 299993025 AND (column_3 = 3);
    
    < 234563210, 299993025, 3, N >

    What am I missing?

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.