473,320 Members | 1,744 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,320 software developers and data experts.

Adding Values in Table

I've got two columns that I want to add the values and then insert it
into the table as a new column. I've got the query as such:

Select [Sold YTD]+[Used YTD] As Total_YTD
>From Parts;
The problem I run into is how do I then take the results Total_YTD and
insert it back into the table.
Any insights would be greatly appreciated. Thanks.

Nov 17 '06 #1
5 5967
First, If you can readily calculate it why store it?

If you have a reason for storing, try:
1. Add the Total_YTD column to the table.
2. Change query to

UPDATE tblTableName
SET tblTableName.Total_YTD =
(tblTableName.[Sold YTD] = tblTableName.[Used YTD]);

Kevin C

"JJM0926" <jj*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
I've got two columns that I want to add the values and then insert it
into the table as a new column. I've got the query as such:

Select [Sold YTD]+[Used YTD] As Total_YTD
>>From Parts;

The problem I run into is how do I then take the results Total_YTD and
insert it back into the table.
Any insights would be greatly appreciated. Thanks.

Nov 17 '06 #2

Kc-Mass wrote:
First, If you can readily calculate it why store it?

If you have a reason for storing, try:
1. Add the Total_YTD column to the table.
2. Change query to

UPDATE tblTableName
SET tblTableName.Total_YTD =
(tblTableName.[Sold YTD] = tblTableName.[Used YTD]);

Kevin C

"JJM0926" <jj*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
I've got two columns that I want to add the values and then insert it
into the table as a new column. I've got the query as such:

Select [Sold YTD]+[Used YTD] As Total_YTD
>From Parts;
The problem I run into is how do I then take the results Total_YTD and
insert it back into the table.
Any insights would be greatly appreciated. Thanks.
Thanks. The Update query above worked

Nov 17 '06 #3
Hope you noticed the typo on the secodn equal sign.
"JJM0926" <jj*****@gmail.comwrote in message
news:11*********************@h54g2000cwb.googlegro ups.com...
>
Kc-Mass wrote:
>First, If you can readily calculate it why store it?

If you have a reason for storing, try:
1. Add the Total_YTD column to the table.
2. Change query to

UPDATE tblTableName
SET tblTableName.Total_YTD =
(tblTableName.[Sold YTD] = tblTableName.[Used YTD]);

Kevin C

"JJM0926" <jj*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googleg roups.com...
I've got two columns that I want to add the values and then insert it
into the table as a new column. I've got the query as such:

Select [Sold YTD]+[Used YTD] As Total_YTD
From Parts;

The problem I run into is how do I then take the results Total_YTD and
insert it back into the table.
Any insights would be greatly appreciated. Thanks.

Thanks. The Update query above worked

Nov 17 '06 #4
Yeah I notived it. I ran into a little snag. It inserted the results
into the table, but inserted it as text--how do I insert it as an
integer or numeric value not text. Thanks.

Kc-Mass wrote:
Hope you noticed the typo on the secodn equal sign.
"JJM0926" <jj*****@gmail.comwrote in message
news:11*********************@h54g2000cwb.googlegro ups.com...

Kc-Mass wrote:
First, If you can readily calculate it why store it?

If you have a reason for storing, try:
1. Add the Total_YTD column to the table.
2. Change query to

UPDATE tblTableName
SET tblTableName.Total_YTD =
(tblTableName.[Sold YTD] = tblTableName.[Used YTD]);

Kevin C

"JJM0926" <jj*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
I've got two columns that I want to add the values and then insert it
into the table as a new column. I've got the query as such:

Select [Sold YTD]+[Used YTD] As Total_YTD
From Parts;

The problem I run into is how do I then take the results Total_YTD and
insert it back into the table.
Any insights would be greatly appreciated. Thanks.
Thanks. The Update query above worked
Nov 21 '06 #5
In the design view of your table make sure that you have defined
the new field, Total _YTD as data type "Number"

"JJM0926" <jj*****@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
Yeah I notived it. I ran into a little snag. It inserted the results
into the table, but inserted it as text--how do I insert it as an
integer or numeric value not text. Thanks.

Kc-Mass wrote:
>Hope you noticed the typo on the secodn equal sign.
"JJM0926" <jj*****@gmail.comwrote in message
news:11*********************@h54g2000cwb.googlegr oups.com...
>
Kc-Mass wrote:
First, If you can readily calculate it why store it?

If you have a reason for storing, try:
1. Add the Total_YTD column to the table.
2. Change query to

UPDATE tblTableName
SET tblTableName.Total_YTD =
(tblTableName.[Sold YTD] = tblTableName.[Used YTD]);

Kevin C

"JJM0926" <jj*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googleg roups.com...
I've got two columns that I want to add the values and then insert
it
into the table as a new column. I've got the query as such:

Select [Sold YTD]+[Used YTD] As Total_YTD
From Parts;

The problem I run into is how do I then take the results Total_YTD
and
insert it back into the table.
Any insights would be greatly appreciated. Thanks.
Thanks. The Update query above worked

Nov 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Sunny K | last post by:
Hi guys, I have a field in my DB called EventDate as a DateTime field, therefore it holds both the date and time together like this: '2004-10-14 08:42:57.000'. I need to add together all the...
1
by: HolaGoogle | last post by:
Hi all, Please help me with the following..it's realy urgent and i tried everything i could and i can't get it work properly!! Thanks in advance. Here's what i'm trying to accomplish: in my...
5
by: Paul | last post by:
Hi I have a table that currently has 466 columns and about 700,000 records. Adding a new DEFAULT column to this table takes a long time. It it a lot faster to recreate the table with the new...
2
by: Viorel | last post by:
Adding new row with default values. In order to insert programmatically a new row into a database table, without direct "INSERT INTO" SQL statement, I use the well-known DataTable.NewRow,...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
5
by: Aaron Ackerman | last post by:
I have a bound combobox the appears on a cell within the column of my bound grid when the user clicks on a cell n(In my vb.net WinForm app). I am trying to allow the adding of an item to that bound...
10
by: Trevor | last post by:
Hey, I am trying to do this tutorial on the microsoft site : http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dndotnet/html/usingadonet.asp I can get everything to work up to...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
7
by: Miro | last post by:
Im a VB Newbie so I hope I'm going about this in the right direction. I have a simple DB that has 1 Table called DBVersion and in that table the column is CurVersion ( String ) Im trying to...
3
by: john | last post by:
In my form (table A) I have subform (table B (only 2 fieds: ID and App_name) where table A -Table B are linked 1XM. To be able to add a record in the subform I want to use a lookup form since the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.