ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Update a table using another table

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> SQL Programming (MS SQL Server, MS Access, MySQL)
View previous topic :: View next topic  
Author Message
daniel_5191



Joined: 26 Jul 2005
Posts: 7
Location: Malaysia

PostPosted: Fri Aug 12, 2005 10:58 am    Post subject: Update a table using another table Reply with quote

<%
dim str ,
str= "UPDATE backup SET backup.bid=login.userid , backup.bpass=login.userpassword,"
str=str & " backup.bname=login.username FROM backup , login WHERE backup.bid=login.userid"

con.execute str
%>
I try to UPDATE the backup table using the login table
Database : Access
Language : ASP
IE Error Problem : Syntax error (missing operator) in query expression 'login.username FROM backup'.


Thank you for your help . I am newbie in SQL and ASP too . Admin , can write me some example to do that ? Thank you .
Back to top
View user's profile Send private message MSN Messenger
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Fri Aug 12, 2005 1:21 pm    Post subject: Reply with quote

Change the statement to this and it should work:

str= "UPDATE backup SET backup.bid=login.userid , backup.bpass=login.userpassword,"
str=str & " backup.bname=login.username FROM login WHERE backup.bid=login.userid"



Cheers,
_________________
Peter
ASP & ASP.NET Articles and Tutorials
Back to top
View user's profile Send private message
x-raysteve



Joined: 01 Feb 2006
Posts: 53

PostPosted: Wed Feb 01, 2006 7:14 pm    Post subject: Reply with quote

This is a bit confusing.

Is the purpose of this to just create a complete backup of the original table? Or is the backup table different in some way?
Back to top
View user's profile Send private message
paul



Joined: 11 Oct 2004
Posts: 128

PostPosted: Wed Feb 01, 2006 7:49 pm    Post subject: Reply with quote

These are 2 different tables, and the SQL statement just updates some of the fields from the first table using values from the second. Of course there must be a common field between the two tables in order to perform meaningful update.
_________________
World Countries | Survival Skills
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> SQL Programming (MS SQL Server, MS Access, MySQL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial