Reputation: 607
I have three columns in my MS Access table with names 'Column1' ,'Column2' and 'Result.'These three columns are text fields. Now, I need a query to divide first column with second column and store the result into third column.
EX : Column1/Column2= Result.
Here , Main problem is the three fields are text fields. Can anyone please help me on this.
Thanks & Regards madhu.
Upvotes: 1
Views: 933
Reputation: 1269873
You need to convert the values to a number and then back. Something like:
select cstr(cdbl(column1) / cdbl(column2)) as Result
However, I would strongly advise you to store numbers as numbers and not as strings. Storing them as strings will just make your code less efficient and harder to debug.
EDIT:
As an update, this looks like:
update table
set Result = cstr(cdbl(column1) / cdbl(column2));
Upvotes: 1