473,795 Members | 2,840 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with using an a subquery in an update

2 New Member
Hi Everyone,
Im sure this is an easyone, im a newbie to anything half complex in sql so any help would be greatly appreaciated.
I have one table that has two values, i need to multiply those values and stick the result back into the table.
I have used the script below but getting an error:
"Subquery returned more than 1 value. This is not permitted when the subquery follows"

Script used:
Expand|Select|Wrap|Line Numbers
  1. update dbo.PCProjectEntry 
  2. set ValueToBillInDocCurrency = (select ChargeRateInBaseCurrency*Quantity 
  3. FROM dbo.PCProjectEntry as b where b.PCProjectEntryID = PCProjectEntryID)
Dec 20 '07 #1
2 1532
deepuv04
227 Recognized Expert New Member
Hi Everyone,
Im sure this is an easyone, im a newbie to anything half complex in sql so any help would be greatly appreaciated.
I have one table that has two values, i need to multiply those values and stick the result back into the table.
I have used the script below but getting an error:
"Subquery returned more than 1 value. This is not permitted when the subquery follows"

Script used:
update dbo.PCProjectEn try
set ValueToBillInDo cCurrency = (select ChargeRateInBas eCurrency*Quant ity
FROM dbo.PCProjectEn try as b where b.PCProjectEntr yID = PCProjectEntryI D)

hi,

try the following

update dbo.PCProjectEn try
set ValueToBillInDo cCurrency = ChargeRateInBas eCurrency*Quant ity

the above query will update all the values in the table


update dbo.PCProjectEn try
set ValueToBillInDo cCurrency = ChargeRateInBas eCurrency*Quant ity
PCProjectEntryI D = PCProjectEntryI D_val

will update specific record
Dec 20 '07 #2
neilgilbert1234
2 New Member
Yep that did the trick..... thanks very much.....
Dec 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4688
by: Nicolas Payre | last post by:
Hi, I have the following SQL that I want to use to update a table. It doesn't work ! Does someone knows why? ** I Know it could be done easy with a CURSOR FOR LOOP, but still... Thanks for your help. update XSORA1A.XS0011T_STATISTIQUES_UNIX a
0
15006
by: Murali | last post by:
Hi All I was reading thro the posting(s) of Thomas Kyte and his nifty approach to doing updates without the need for unnecessary correlated subqueries. An alternative to correlated subquery using this technique is: update ( select columnName, value from name, lookup
1
1868
by: Chris Michael | last post by:
I've only just started using update queries and have a problem with the following query in that it comes back with this error: "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression." Query: UPDATE tbl_customerpassword SET tbl_customerpassword.passnumber = '1111' where tbl_customerpassword.customerid = (
15
3625
by: Hemant Shah | last post by:
Folks, We have an SQL statement that was coded in an application many years ago (starting with DB V2 I think). When I upgraded to UDB 8.2, the optimizer does not use optimal path to access the data. It takes about 4 minutes to get the data. In previous versions it was instantaneous. What do I need to do to increase the performance?
1
7267
by: sivaram | last post by:
Hi all, I have the following query in Visual Foxpro that is throwing error. UPDATE T1 set T1.C2 = (select T2.C2 from T2 where T1.c1 = T2.C1)
8
19603
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a couple of tables in my database using INNER JOINS and the WHERE clause to specify the required constraints. However, I also want to read two fields from a *single* record from a table called 'Locations' and then apply one of these field's values...
4
1919
by: solidsna2 | last post by:
Hi, I am relatively new to SQL. I am using SQL 2000. I am trying to Update a field base in a criteria in a scond table. UPDATE Tbl1 SET Tbl1.Row2 = '1' WHERE Tbl1.Row1 = (SELECT Tbl1.Row1 FROM Tbl2, Tbl1
12
3938
by: info | last post by:
The following query works fine in access and does exactly what I want it to do however I get a syntax error when I port it over to SQL Server 2000. ------------- UPDATE OrdersProducts INNER JOIN Products ON OrdersProducts.ProductID = Products.ProductID SET Products.Stock = Products.Stock-OrdersProducts.Quantity WHERE OrdersProducts.OrderID=63116
3
33767
by: Manikandan | last post by:
Hi, I have table with three columns as below table name:exp No(int) name(char) refno(int) I have data as below No name refno 1 a 2 b 3 c
2
1572
by: HeavenCore | last post by:
Hello all, i have a process which reads 2 csv files into two different tables (thus there is no real primary key etc) i need to update 1 column in one table (EnterpriseBuffer) with data from another table (EnterpriseProdGroupToAnalystDeptMap.AnalystDepartment). This is done where EnterpriseBuffer.PG = EnterpriseProdGroupToAnalystDeptMap.EnterprisePG. I attempted the following: Update EnterpriseBuffer SET...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2922
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.