Results 1 to 2 of 2
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    636

    Update With Group By

    I have a table that was a spreadsheet import that consists of data like such


    Code:
    Buyer   Item            InStock     ShipAll
    4         Stove90        Yes
    8         Mit23            No
    10       Cap12           No
    4         Game01        No
    6         Genie21        Yes
    6         Glove33        Yes
    Now I need an update query that will update ShipAll if every Item for a buyer is marked as instock. So in the above sample set ONLY Buyer 6 should have both records flagged as Yes, buyer 4 has 1 item not in stock and 8 and 10 have an item not in stock.

    I tried to use the below query, but it is missing the criteria of ALL items for the buyer
    Code:
    UPDATE shipments SET shipments.ShipAll = 'Yes' WHERE (((shipments.InStock)='Yes'));
    How can I add the criteria of all items for the buyer to this update statement?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,123
    Ideally, would not save this data, calculate when needed.

    ShipAll and InStock are text type fields?

    UPDATE shipments SET shipments.ShipAll = 'Yes' WHERE NOT Buyer IN (SELECT Buyer FROM shipments WHERE InStock='No');
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 04-04-2015, 08:53 AM
  2. Update query with Option Group Value
    By bcofie in forum Access
    Replies: 6
    Last Post: 08-08-2012, 02:51 PM
  3. Totals (group b)y + Update query?
    By acenumber5 in forum Queries
    Replies: 4
    Last Post: 06-14-2012, 10:47 AM
  4. automatically update club members age group
    By sirnickettynox in forum Programming
    Replies: 4
    Last Post: 04-06-2011, 06:52 AM
  5. Help designing a group update form
    By 10 Gauge in forum Forms
    Replies: 22
    Last Post: 03-28-2011, 10:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums