View previous topic :: View next topic |
Author |
Message |
daniel_5191
Joined: 26 Jul 2005 Posts: 7 Location: Malaysia
|
Posted: Fri Aug 12, 2005 10:58 am Post subject: Update a table using another table |
|
|
<%
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 |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Fri Aug 12, 2005 1:21 pm Post subject: |
|
|
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 |
|
|
x-raysteve
Joined: 01 Feb 2006 Posts: 53
|
Posted: Wed Feb 01, 2006 7:14 pm Post subject: |
|
|
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 |
|
|
paul
Joined: 11 Oct 2004 Posts: 128
|
Posted: Wed Feb 01, 2006 7:49 pm Post subject: |
|
|
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 |
|
|
|
|
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
|