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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 dont understand this error

Author  Topic 

gogetsome
Starting Member

10 Posts

Posted - 2005-10-18 : 16:17:02
Hello, I could use some help with this error message:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

This if statement is causing the problem. Any help would be great!

IF (select bill_freq from #header1) = '1'
update #header1 Set
[Monthend] = aa.pername
from sv00564 zz inner join sv00532 aa on zz.wennsoft_period_id = aa.wennsoft_period_id
Where zz.rmdnumwk like #header1.Invoice_Number

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-10-18 : 16:19:08
You have more than one bill_freq that equals 1.

update #header1 Set
[Monthend] = aa.pername
from sv00564 zz inner join sv00532 aa on zz.wennsoft_period_id = aa.wennsoft_period_id
Where zz.rmdnumwk like #header1.Invoice_Number AND bill_freq = '1'

Tara
Go to Top of Page

gogetsome
Starting Member

10 Posts

Posted - 2005-10-18 : 16:31:33
Yes, that should be correct. I need to be able to update all the fields that contain '1' to the value of aa.pername. How can the if statement be modified to do that?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-10-18 : 16:39:27
How many columns?

Tara
Go to Top of Page

gogetsome
Starting Member

10 Posts

Posted - 2005-10-18 : 16:41:10
Thanks so much for helping.

Just one column [monthend]
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-10-18 : 16:47:06
The update statement that I posted already does this.

Tara
Go to Top of Page

gogetsome
Starting Member

10 Posts

Posted - 2005-10-18 : 16:58:33
oops, sorry I didn't see the change. Thanks for hleping.
Go to Top of Page
   

- Advertisement -