Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Posts
    1

    Unhappy Unanswered: How do I make this query work

    UPDATE w_pulls
    SET w_pulls.wpu_pull_ind = 'N', w_pulls.wpu_grp_pull_ind = 'N'
    WHERE w_pulls.wpu_group NOT in ('909','909') AND w_pulls.wpu_tkt_batch NOT in ('0001','0002')

    UPDATE w_pulls
    SET w_pulls.wpu_pull_ind = 'Y', w_pulls.wpu_grp_pull_ind = 'Y'
    WHERE w_pulls.wpu_group in ('909','909') AND w_pulls.wpu_tkt_batch in ('0001','0002')

    How do I make something like this work. It doesnt want to recognized the differences in the two. For instance if I remove the '909' and '0001' from the query it still tries to update all instances of '909'


    dmagill <--- Very Confused.

  2. #2
    Join Date
    Mar 2003
    Posts
    8

    Re: How do I make this query work

    Try this
    UPDATE w_pulls
    SET w_pulls.wpu_pull_ind = 'N', w_pulls.wpu_grp_pull_ind = 'N'
    WHERE w_pulls.wpu_group<>'909' AND (w_pulls.wpu_tkt_batch<>'0001' or w_pulls.wpu_tkt_batch<>'0002')

    Try this
    UPDATE w_pulls
    SET w_pulls.wpu_pull_ind = 'Y', w_pulls.wpu_grp_pull_ind = 'Y'
    WHERE w_pulls.wpu_group='909' AND (w_pulls.wpu_tkt_batch='0001' or w_pulls.wpu_tkt_batch='0002')

    How do I make something like this work. It doesnt want to recognized the differences in the two. For instance if I remove the '909' and '0001' from the query it still tries to update all instances of '909'

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what do you want to do?

    try running the SELECT alone, without updating anything (unless it's too late already, eh)

    the problem most likely is in your logic

    whenever you mix ANDs and ORs and INs and parentheses and NOTs, the logic gets messy

    if you work with the logic in a SELECT, it will make things easier, and you won't screw up your data


    rudy

Posting Permissions

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