a little issue with an update query

i am trying to set values in a table if criteria matchis info from another table,
I have checked and 1 have 71 entries that match the select query contained below..

update [SUBSCRIBER].[dbo].[Subscriber Status]
set IsRecurring = 'true',
RecurCode = 'NSR',
RecurEvery = '31',
RecurInterval = '2'
WHERE Stat.AccountID IN ( SELECT * 
FROM [SUBSCRIBER].[dbo].[Subscriber Status] Stat
LEFT JOIN [SUBSCRIBER].[dbo].[Subscriber Data] Subscriber ON Stat.AccountID = Subscriber.AccountID

WHERE Subscriber.AcctLineCode = 'RSV')

Open in new window


when I execute I get the following...

Msg 4104, Level 16, State 1, Line 6
The multi-part identifier "Stat.AccountID" could not be bound.
Msg 116, Level 16, State 1, Line 10
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

I have also tried the following.

update [SUBSCRIBER].[dbo].[Subscriber Status]
set IsRecurring = 'true',
RecurCode = 'NSR',
RecurEvery = '31',
RecurInterval = '2'
WHERE EXISTS ( SELECT * 
FROM [SUBSCRIBER].[dbo].[Subscriber Status] Stat
LEFT JOIN [SUBSCRIBER].[dbo].[Subscriber Data] Subscriber ON Stat.AccountID = Subscriber.AccountID

WHERE Subscriber.AcctLineCode = 'RSV')

Open in new window


however it would appear it is changing every row (17794 row(s) affected)

How would i put together a query that checks dbo.Subscriber Status for AcctLineCode = 'RSV' and changes information that corresponds to that AccountID on dbo.Subscriber Status  ?
LVL 1
csePixelatedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Obadiah ChristopherCommented:
update [SUBSCRIBER].[dbo].[Subscriber Status]
set IsRecurring = 'true',
RecurCode = 'NSR',
RecurEvery = '31',
RecurInterval = '2'
WHERE AccoundID in ( SELECT Subscriber.AccountID 
FROM [SUBSCRIBER].[dbo].[Subscriber Status] Stat
LEFT JOIN [SUBSCRIBER].[dbo].[Subscriber Data] Subscriber ON Stat.AccountID = Subscriber.AccountID

WHERE Subscriber.AcctLineCode = 'RSV')

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
csePixelatedAuthor Commented:
Great, ty Obadiah Christopher
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.