Hi there,
I'm currently trying to fix up a database that has had many different
people work on it and therefore is confusing me no end.
Currently i am trying to update a field, [Person ID] in the table
[CAST] .
[Person ID] is a numeric field and is linked to the [Personnel Tbl]
(its the PK)
this needs to be updated according to another field [By Whom] in the
[CAST] table, which is a text field.
[By Whom] is in the format of Surname, First Name
so what i need to know is how do i write an update query that will
update [Person ID] to be a reference of the [Personnel Tbl] according
to the surname in the [By Whom] field.
I hope this makes sense and appreciate any help i can get, my head is
getting sore!
Cheers, Aaron 3 1613
On 5 Dec 2006 19:56:28 -0800, aa*****@aapt.ne t.au wrote:
Your explanation makes sense, but it also shows a VERY BAD database
design.
ByWhom should be replaced by a PersonID. This works towards the power
of relational databases. Work on that first. Other issues will start
falling into place.
-Tom.
>Hi there,
I'm currently trying to fix up a database that has had many different people work on it and therefore is confusing me no end.
Currently i am trying to update a field, [Person ID] in the table [CAST] .
[Person ID] is a numeric field and is linked to the [Personnel Tbl] (its the PK) this needs to be updated according to another field [By Whom] in the [CAST] table, which is a text field.
[By Whom] is in the format of Surname, First Name
so what i need to know is how do i write an update query that will update [Person ID] to be a reference of the [Personnel Tbl] according to the surname in the [By Whom] field.
I hope this makes sense and appreciate any help i can get, my head is getting sore!
Cheers, Aaron
Your explanation makes sense, but it also shows a VERY BAD database
design.
ByWhom should be replaced by a PersonID. This works towards the power
of relational databases. Work on that first. Other issues will start
falling into place.
Thanks for the reply Tom,
You're dead right, it is a wizard nightmare!
The main issue is that this database system is used on several
different sites
(all separate data) and the solution has to be automated. There is
heaps of
data as well. I have fixed it up so that all new data is written to
PersonID,
but need to get the old data from ByWhom to PersonID, which is hard
because one
is numerical and the other text.
I have tried changing PersonID to a text field and running a simple
update
query, this looks like it works but none of the reports work because
the
updated data is in text not a numerical reference to the PersonnelTbl.
I then tried a left split formula to separate the surname and insert
the PersonnelID according to the surname but this comes up with an
error message ( I can't remember what it is, will post in an hour or
so).
Any ideas would be great, i'm running in circles
Cheers Aaron.
Heres the SQL I've been playing with
UPDATE [Corrective Action Subform Table]
INNER JOIN [Personnel Tbl] ON [Corrective Action Subform Table].[Person
ID] = [Personnel Tbl].[Person ID]
SET [Corrective Action Subform Table].[Person ID] = [Personnel
Tbl].[Person ID]
WHERE ((([Corrective Action Subform Table].[Person ID])=0) AND
((Left([By Whom],InStr([By Whom]," ")-1))=[Personnel Tbl].[Surname]));
This for some reason returns 0 updates, if i remove the Person ID = 0
criteria I then get a message "Invalid Procedure Call". This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike Leahy |
last post by:
Hello all,
This question is related to updating tables - is there any way to calculate or
update the values in a column in a table to the values in a field produced by
a query result? An example of what I'm trying to do is below:
update (tbl_ind_mananas LEFT JOIN (select count(*) as count, (dubicacion ||
zona || manzana) as cod_manzana from tbl_censo_poblacion_1993 group by
dubicacion, zona, manzana) tbl1 on relacion = cod_manzana) as...
|
by: Kunal |
last post by:
Hi,
I need some help on writing an update query to update "UnitsSold" field in
Products Table whenever I save a transaction. The transaction may contain
several "Subtransactions", one for each product sold in that transaction. I
have a subtransaction table that maintains record of each subtransaction,
with data such as: ProductID, Quantity, TransactionID etc.
The Products table has fields: ProductID, UnitsSold, UnitsOrdered,...
|
by: Megan |
last post by:
hi everybody-
it seems like my update query should work. the sql view seems logical.
but that might be up to discussion...lol...i'm a newbie!
UPDATE , Issue SET .IssueID = .
WHERE ((.=.));
|
by: James Butler |
last post by:
Our setup:
Online db: MySQL
Inhouse db: MS Access 97 with MySQL tables linked via ODBC
Our issue:
Almost every field updates successfully, except one.
A scenario:
Information is written to online db.
We run an inhouse query to collect info from online db and update
|
by: Maxi |
last post by:
There is a lotto system which picks 21 numbers every day out of 80
numbers.
I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21)
Here is the structure and sample data:
"Date","P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16","P17","P18","P19","P20","P21"
1/1/2005,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21
1/2/2005,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
| |
by: Sparticus |
last post by:
I have a database that isn't very big. It has about 2400 rows in it.
I try and do an update like this one below (it looks big, but it's
really not if you look at it) :
UPDATE jobs
SET prodduedate = '1/5/2005', clientduedate = '1/5/2005', digitizingcnd
= 'x', digitizingcndnonsub = '', digitizingintl = '', retrieval = '',
wellsitetape = '', boardsubmissions = '', hardcopylogs = '', burningcd
= '', las20 = '', metric = '', tops = '',...
|
by: Tom Allison |
last post by:
I seemed to remember being able to do this but I can't find the docs.
Can I run a sql query to insert new or update existing rows in one query?
Otherwise I have to run a select query to see if it's there and then
another one to update/insert.
What I'm trying to do is create a counter for each key, insert a value
of 1 or increment the value by 1 and then set another specific row
(where key = $key) to always increment by 1.
|
by: P3Eddie |
last post by:
Hello all!
I don't know if this can even be done, but I'm sure you will either help or suggest another avenue to accomplish the same.
My problem may be a simple find duplicates / do something with only one of the duplicates issue, but I got to the point where an update query with a nested select subquery would work wonderfully, if only it would work!
I have several fields in a master Access 2000 table, some of which are id, fname,...
|
by: Chris Cowles |
last post by:
I use an application that uses Oracle 8.1.7. All functions of the
application are completed with calls to stored procedures. A data entry
error occurred that caused thousands of records to be created with a
consistent error in a single field. I can identify those easily records with
a select statement. I'd *really* rather not have to change them all
manually.
I do have access to run a simple update query to correct only the field in...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: 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();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |