Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update Value using Subquery

Author  Topic 

waseemtahir
Starting Member

2 Posts

Posted - 2009-11-16 : 09:43:55
Dear,

i want to update a value in existing Account table having more than 4000 rows from CostSheet table.
if IDs match
tblAccountVoucher.Voch_ID=tblLPOACSheet.Voch_ID

i am using this query.

Update tblAccountVoucher SET Attached=1
where tblAccountVoucher.Voch_ID = (select Voch_ID from tblLPOACSheet)

but there is an error any idea.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-16 : 10:00:31
Update V SET V.Attached=1
from tblAccountVoucher as V inner join tblLPOACSheet as S
on V.Voch_ID =S.Voch_ID


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

waseemtahir
Starting Member

2 Posts

Posted - 2009-11-18 : 01:19:02
Thanks its work. i have a problem with inner join query.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-18 : 02:21:44
quote:
Originally posted by waseemtahir

Thanks its work. i have a problem with inner join query.


What is the problem?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -