Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms 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
 
Old September 25th, 2004, 08:31 AM
Authorized User
 
Join Date: Apr 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default increment each row of table

Hi:
  i want to update some rows of myTable of Access.
  i.e if previous value is 5 , then it should be updated by 6.

i use this query to increment value of each row by 5:

update MyTable set p = (select p+5 from MyTable where catID = 2) where catID = 2"

But this query have problemm.
How i do that?

Thanks
Burhan

 
Old September 25th, 2004, 10:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

You don't have to use subquery to set value there. That is not the right approach. Rephrase your query it to this.
Code:
update MyTable set p = p+5 where catID = 2
This would be enough to get that work.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old September 25th, 2004, 11:34 AM
Authorized User
 
Join Date: Apr 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Happygv






Similar Threads
Thread Thread Starter Forum Replies Last Post
Row Count in each table ayazhoda Access VBA 0 April 15th, 2008 04:31 PM
How To insert auto increment ID to other table ibrhaim ASP.NET 1.0 and 1.1 Professional 4 December 8th, 2006 02:26 PM
UPDATING 1 row with another row in same table rit01 SQL Server 2000 3 February 19th, 2006 08:55 AM
first row of a table Adam H-W SQL Language 2 January 11th, 2005 10:15 AM
i need to lock a row in table alyeng2000 SQL Server 2000 6 May 17th, 2004 09:21 AM





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