-
July 12th, 2006, 01:18 AM
#1
Update a Table
How can we update TableA based the corresponding value in TableB
ie I have two table OrgMembers and CopyMembers
the query is :
Update OrgMember Set OrgMember.LeftPaid=CopyMember.LeftPaid Where OrgMember.UserID=
CopyMember.userID
I get an error :
The column prefix 'CopyMember' does not match with a table name or alias name used in the query.
Thanks,
VK
-
July 12th, 2006, 03:11 AM
#2
Re: Update a Table
Hi,
Just add From Clause with you statment.
Update OrgMember Set OrgMember.LeftPaid=CopyMember.LeftPaid FROM COPYMEMBER Where OrgMember.UserID=
CopyMember.userID
Regards
Sivar
-
July 12th, 2006, 03:12 AM
#3
Re: Update a Table
Hi all,
Try a query like this
Update OrgMember O
Set O.LeftPaid = (SELECT C.LeftPaid
FROM CopyMember C
Where O.UserID = C.userID)
WHERE 0.UserID = (SELECT C.UserID
FROM CopyMember C
Where O.UserID = C.userID)
I haven't tried it, but I think it works correctly.
-
July 13th, 2006, 02:16 AM
#4
-
July 13th, 2006, 05:38 AM
#5
Re: Update a Table
why dont you tell us what database technology youre using first?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|