Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 26th, 2003, 04:19 AM
Registered User
Join Date: Nov 2003
Location: Ridgeland, MS, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default SUM or What

Hello, I have a table that has several money columns and want to update multiple records based on my query. The records need to SUM or ADD like so column1 = column1 + column2 then set column2 to 0.
After that a math function runs on all the changed records. Any advice for most efficient way would be welcome. I am using VB6 and ADODB. I can make this happen completely through VB6 but thought that SQL Transaction Processing might be faster and more efficient.
Thanks B

  #2 (permalink)  
Old November 26th, 2003, 12:11 PM
Friend of Wrox
Join Date: Jun 2003
Location: Sparks, NV, USA.
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jlick


    UPDATE TableName
        SET Column1 = Column1 + Column2,
            Column2 = 0
    WHERE -- Limit to the correct rows.

John R Lick
  #3 (permalink)  
Old November 29th, 2003, 02:44 PM
Registered User
Join Date: Nov 2003
Location: Ridgeland, MS, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks John,
That helped a lot!
I have much to learn and this project has been a fun challenge.

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sum satish_baleri XSLT 6 October 24th, 2007 03:43 AM
how to sum in for-each Gjella XSLT 1 October 2nd, 2006 08:48 AM
Help: Running Sum (or Cumulative Sum) timdasa VB Databases Basics 1 August 22nd, 2006 03:12 PM
sum utarian Access 2 March 28th, 2005 09:42 PM
need sum help! jbik BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 December 20th, 2004 05:27 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.