Update Query [message #7031] |
Fri, 16 May 2003 08:47 |
Ray
Messages: 58 Registered: January 2000
|
Member |
|
|
Here is a table that I am working with:
Table A
KEY Unique, Not Null
COLA Not Null, Number
COLB Not Null, Number
COLC Null, VARCHAR
I did not design these tables or columns so can't change the formatting. The problem that I am up against is, I don't know an easy way to fill COLC from the difference between COLA and COLB based on the KEY field.ex. (COLC = COLA / COLB for Unique KEY).
I am new at cursors and the like so any help is greatly appreciated. I was trying to use an Update Query command but it has 4500+ rows and it never worked. Thanks in advance.
|
|
|
Re: Update Query [message #7032 is a reply to message #7031] |
Fri, 16 May 2003 11:09 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Of course, it is not a good idea at all to store a calculated field, but...
update a
set colc = (cola / colb);
That's all there is to it.
|
|
|
Re: Update Query - Still have a problem [message #7033 is a reply to message #7032] |
Fri, 16 May 2003 12:04 |
Ray
Messages: 58 Registered: January 2000
|
Member |
|
|
Hi,
Thanks for the help and I understand that you shouldn't but since I didn't build them just maintain them.....
Anyway, Can I do that for just certain key field identifiers by using a where clause? ex. update a set colc = (cola / colb) where keyfield = *****;
|
|
|
|
|