473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Update Query Producing Zero Values

88
I have a field in my main table called "CHANGE". Each week before we update the data we create a backup of the table and adjust the CHANGE field for all records to zero. I have an update query where I am updating the CHANGE field with the difference between the main table's RATE field and the backup table's RATE field. For some reason, it is assigning a zero value to some of the changes instead of the actual change, but then some of them are pulling through. At first I thought that it was just with the rates that decreased, but both positive and negative numbers are comming through and/or being set to zero. I then thought that it was because of the data type of the field so I set the field to a Double, Fixed, 3 Decimal Places, and even changed the properties of the calculated field in the update query. I also read somewhere online that if the field is null that it can mess up an update query so I adjusted all the CHANGE fields to zero before running the update query and I get the same results.

Any idea why it would be assigning a value of zero for some changes but not for others?
Oct 20 '07 #1
3 1881
fperri
88
If I do just a regular select query I get the correct change amounts, its when I turn it into an update query where it sets some of the change amounts to zero.
Oct 20 '07 #2
nico5038
3,080 Expert 2GB
Hmm, logically it looks a bit strange to move a value to a backup table, initialize it in the original table to zero and then update it with the difference. Looks to me that the result will be the same (original) value as a value -/- 0 will de that value again...

So basically I wonder what you expect to happen from this algoritm..

Nic;o)
Oct 20 '07 #3
fperri
88
Hmm, logically it looks a bit strange to move a value to a backup table, initialize it in the original table to zero and then update it with the difference. Looks to me that the result will be the same (original) value as a value -/- 0 will de that value again...

So basically I wonder what you expect to happen from this algoritm..

Nic;o)

Getting the difference between the current and backup table's RATE column and putting it in the current table's CHANGE column. If they are the same it assigns a zero and if there is a difference it will show the change amount.

I ended up scrapping this approach and created a form instead for the user's to enter their changes into. Then using the form's before and after update events I was able to create a log table that holds these change values. Then I created a report from this log. It works nicely.

~ Franccesca
Feb 6 '08 #4

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

Similar topics

19
by: Westcoast Sheri | last post by:
To keep track of how many fruits my visitors buy, I use a mySQL database (2 columns: "fruit" and "quantity")....so can we make these following mySQL queries work somehow? (visitor buys 5...
0
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default...
4
by: Karaoke Prince | last post by:
Hi There, I have an update statement to update a field of a table (~15,000,000 records). It took me around 3 hours to finish 2 weeks ago. After that no one touched the server and no...
1
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...
4
by: Scott Berry | last post by:
This is a little frustrating, because it should be easy. I have an application that has been converted to SQL Server 2000 from MS Access 97. New data is loaded each week and one of my old queries...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
8
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: ...
1
by: Mikle | last post by:
I need to update values in a table (where they are null or zero) with values from another table for the corresponding PopulationMemberID. Now I now that you can't update where there is a join.....
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
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...

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.