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 (EnterpriseBuff er) with data from another table (EnterpriseProd GroupToAnalystD eptMap.AnalystD epartment). This is done where EnterpriseBuffe r.PG = EnterpriseProdG roupToAnalystDe ptMap.Enterpris ePG.
I attempted the following: - Update EnterpriseBuffer SET EnterpriseBuffer.AnalystDepartment =
-
(SELECT dbo.EnterpriseProdGroupToAnalystDeptMap.AnalystDepartment
-
FROM EnterpriseBuffer LEFT OUTER JOIN dbo.EnterpriseProdGroupToAnalystDeptMap ON dbo.[EnterpriseBuffer ].PG = dbo.EnterpriseProdGroupToAnalystDeptMap.EnterprisePG)
-
WHERE EnterpriseBuffer.PIPCode NOT IN (select buyingcode from AnalystBuffer)
However this fails due to:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
now i understand why this occurs, as the sub select returns 10700 rows, the same as a select * from EnterpriseBuffe r would return. i just need to update analystdepartme nt column for each row in EnterpriseBuffe r with the EnterpriseBuffe r version in EnterpriseProdG roupToAnalystDe ptMap.
This sounds very coimplicating i know, but please, any information or resolution to this would be helpful.
2 1572 deepuv04 227
Recognized Expert New Member
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 (EnterpriseBuff er) with data from another table (EnterpriseProd GroupToAnalystD eptMap.AnalystD epartment). This is done where EnterpriseBuffe r.PG = EnterpriseProdG roupToAnalystDe ptMap.Enterpris ePG.
I attempted the following: - Update EnterpriseBuffer SET EnterpriseBuffer.AnalystDepartment =
-
(SELECT dbo.EnterpriseProdGroupToAnalystDeptMap.AnalystDepartment
-
FROM EnterpriseBuffer LEFT OUTER JOIN dbo.EnterpriseProdGroupToAnalystDeptMap ON dbo.[EnterpriseBuffer ].PG = dbo.EnterpriseProdGroupToAnalystDeptMap.EnterprisePG)
-
WHERE EnterpriseBuffer.PIPCode NOT IN (select buyingcode from AnalystBuffer)
However this fails due to:
now i understand why this occurs, as the sub select returns 10700 rows, the same as a select * from EnterpriseBuffe r would return. i just need to update analystdepartme nt column for each row in EnterpriseBuffe r with the EnterpriseBuffe r version in EnterpriseProdG roupToAnalystDe ptMap.
This sounds very coimplicating i know, but please, any information or resolution to this would be helpful.
Try the following query......
Update EnterpriseBuffe r SET EnterpriseBuffe r.AnalystDepart ment =
(SELECT dbo.EnterpriseP rodGroupToAnaly stDeptMap.Analy stDepartment
FROM dbo.EnterpriseP rodGroupToAnaly stDeptMap
WHERE EnterprisePG = dbo.[EnterpriseBuffe r].PG)
WHERE EnterpriseBuffe r.PIPCode NOT IN (select buyingcode from AnalystBuffer)
Spot on!
Thanks alot, really appreciate that :D
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Koen |
last post by:
Hi all,
I am experimenting with DAO. I wrote this sub to update one specific field
of one specific row in one specific table. Nothing wrong with the SQL
statement, but when I execute this I get 'Invalid Operation'.
******************* code *************************
Sub UpdateObsStatusAfterStatusChange(intObsID As Integer, intNewValue As
Integer)
|
by: RC |
last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate
event I use
DoCmd.RunSQL ("UPDATE ....
to update records in a table. When it starts to run I get a message
"You are about to update 3 row(s)."
Is there a way to prevent the message from popping up?
|
by: MrMike |
last post by:
Hi. My application has dozens of datagrids but for some reason an exception
occurs when one of them is updated. When a user edits a datagrid row and
then clicks 'Update' the following exception occurs:
---------------------
"Exception Details: System.ArgumentOutOfRangeException: Specified argument
was out of the range of valid values. Parameter name: index"
---------------------
I've placed breakpoints with the UpdateCommand event, but...
|
by: Terry Olsen |
last post by:
I've got 2 different web pages, both updating the same SQL database. One is
for the Technician and one is for the Manager. The technician's update page
works fine but the Manager's update page doesn't. They are both the
same..as far as I can tell...
---------------------
This code works fine, updating the SQL database with the edited data.
Code for Tech Page
|
by: Geraldine Hobley |
last post by:
Hello I'm getting the above mentioned error in my applicatio
I have a datagrid bound to a datasource like s
MyDatagrid.DataSource = Mydataset.Tables(Order) - this all works fine
However I have another field on the form which is a richtextbox and is bound to another field in the same datasourc
like s
Me.RtxtDialog.DataBindings.Add("text", MyDataset.Tables.Item("Orders"), "MyRichTextField") - this field accepts nulls in the databas
| |
by: Jon |
last post by:
Hi,
I have a function to fill the data into the dataset:
Private Sub LoadSystemDataDB(ByVal m_str As String, ByVal da As _
OleDbDataAdapter, ByVal tbName As String)
Dim OleDbConn As New OleDbConnection(OLEDB_CONNECTION_1)
OleDbConn.Open()
da = New OleDbDataAdapter(m_str, OleDbConn)
Dim cmd As New OleDbCommandBuilder(da)
|
by: irfi |
last post by:
Hi,
I am a form which has a sub form,
The sub form is linked with primary key of main form as a foriegn key
in sub form, very basic,
In the main form, I have another field which is investor, and in the
sub form, I have created investory foreign key, this is the second link
between main form and subm form.
|
by: Henry Stockbridge |
last post by:
Hi,
I need a way of bypassing the Report_Close procedure (or come up with
another event to handle the Update Query.) Right now, if I set the
value of Report_NoData to Cancel=True, the Report_Close event fires,
and the message prompt is not applicable.
Here is the code:
Private Sub Report_Close()
|
by: Sharon |
last post by:
Hello All,
Is it possible to update Sql Table through DataGrid. I have a DataGrid
which is being populated through a stored procedure, all i wanted to do
is to update one field (FieldName-Authorised) which has a datatype bit
through DataGrid but not sure how to go about it. Any Ideas Guys on
this one, your help is greatly appreciated.
This is the procedure used to populate the datagrid, The primary key
for the table is EntryID which...
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
Private Sub UpdateTblHistory()
Dim strSql As String
strSql = "Update tbl_History set SubscrID = @SubscrID Where ID = @ID"
da.UpdateCommand.CommandText = strSql
da.UpdateCommand.Parameters.Add("@SubscrID", SqlDbType.VarChar, 50,
"SubscrID")
da.UpdateCommand.Parameters.Add("@ID", SqlDbType.Int, 4, "ID")
da.Update(ds, "tbl_History")
|
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...
| |
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |