Results 1 to 9 of 9
  1. #1
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283

    Update Query Help

    overview: I have a table that has revenue associated with each serial number, so a serial number can be duplicated in the system. What I want to do is if the install revenue is >0 and the Order_code is either 12 or 06 then update the install_units to 1 on the first instance of the serial number.



    I was able to isolate the serial numbers using a select statement but it uses totals to limit the list to 1 instance of the serial number
    Order type - Group By
    Serial Number - Group BY
    Install revenue - MAX

    Is there a way to have this be an update statement somehow even though it uses totals?

    Thanks

    Bret

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Ideally, aggregate data is not saved to tables but is calculated when needed.

    I don't understand duplication of serial number.

    What determines the 'first' instance of serial number - is there a date or a record identifier? Records in table do not have inherent order.
    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.

  3. #3
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    Really all I want to do is put the number 1 in the Install Units field of the first instance of the serial number (if there is more than 1) where order type is either 02 or 16 and Install Revenue is >0

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Doesn't answer my question. What criteria can be used to identify the 'first' instance of each serial number? And why save to only the 'first' and why save aggregate data at all?
    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.

  5. #5
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    I was just using MAX on Revenue to isolate one serial number if there were multiples. The reason why the data is only going on one instance of the serial number is because the install unit count is only 1 per serial number and putting a 1 in all the instances would throw the numbers off

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Do you have a master table of all serial numbers where the serial number is a unique value?

    Max might not be helpful as unique identifier because each instance could have the same Revenue.
    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.

  7. #7
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    not currently but I could create a table with a list of unique serial numbers

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    That would be the easiest place to save the aggregate value.
    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.

  9. #9
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    ok I will give that a try

    Thanks for the help

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

Similar Threads

  1. Replies: 14
    Last Post: 08-12-2014, 06:33 AM
  2. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  3. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  4. Replies: 4
    Last Post: 11-10-2011, 03:41 PM
  5. Replies: 1
    Last Post: 08-19-2011, 12:16 PM

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