Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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 February 28th, 2009, 02:06 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default update one table column from another table column

hi
i have two table
StudentAccountTable and billmonthly
studentaccounttable contain

Student Id Namefield Class Roll BalanceAmount
1001 abc 2 3 2500.00
1002 Dbc 3 3 3500.00
here studentid is primary key

in billmonthly


StudentID Total amount
1001 100
1002 1500
Here StudentId Also Primary Key
now i wann update studentaccounttable (BalanceAmount) at once from Billmonthly (TotalAmount) for this i make query on sql

UPDATE StudentAccountTable
SET BalanceAmount = StudentAccountTable.BalanceAmount+billMonthly.Tota l
FROM StudentAccountTable, billMonthly
WHERE StudentAccountTable.StudentId = billMonthly.StudentId

which work very well
now i want this code work through code
Please help me to do this through code

Thanks in Advance
 
Old February 28th, 2009, 04:46 AM
Authorized User
 
Join Date: Feb 2009
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default

hi

you can use below query

UPDATE TEMP1 SET ID = (SELECT ID FROM TEMP2 WHERE NAME = TEMP1.NAME )

here TEMP1 and TEMP2 tables have common filed called Name.

It will work fine
__________________
Rajendar





Similar Threads
Thread Thread Starter Forum Replies Last Post
update table column from another table elygp SQL Language 6 December 29th, 2008 02:23 AM
auto update from 1 table to column in another tabl headwaters Access 1 December 1st, 2008 08:39 AM
Generating a 3 Column Table garethdown44 XSLT 4 June 14th, 2005 01:22 PM
How can I update 2 rows in one column in SQL table babou Classic ASP Databases 6 March 9th, 2005 11:13 AM
how to make column of table 1 = to column of table gilgalbiblewheel Classic ASP Databases 4 October 11th, 2004 11:57 PM





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