Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8250217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:48:40+00:00 2026-06-07T23:48:40+00:00

Here is what I have, the two columns to be added can be NULL

  • 0

Here is what I have, the two columns to be added can be NULL by default:

UPDATE house SET TOTALTAX=IFNULL(MUNTAX,0)+IFNULL(SCHTAX,0) WHERE NNS_NO=542

This gives me 0 rows affected. I verified the NNS number is correct, I don’t really know what to try next.

Okay, I found out the columns MUNTAX AND SCHTAX are type varchar and not integers. For example, MUNTAX = “$7,725.00”, SCHTAX = NULL in this case.
So the question is now how to extract just the dollar value as an integer before calculating the sum and updating it as varchar (TOTALTAX is also varchar)? Do I need a stored procedure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:48:42+00:00Added an answer on June 7, 2026 at 11:48 pm

    Edit: Ah I see you also want to turn the result back into a VARCHAR. Adding the $ sign back to the front should be easy with CONCAT(), but adding the commas back in would be tricky without writing a custom function. I probably don’t need to tell you, but storing values like this as VARCHARs in the database isn’t a good idea.

    It ain’t pretty, but something like this?

    mysql> SELECT * FROM sum2;
    +--------+--------+-------+
    | a      | b      | total |
    +--------+--------+-------+
    | $1,000 | $2,000 |  NULL |
    | $1,500 | NULL   |  NULL |
    +--------+--------+-------+
    2 rows in set (0.02 sec)
    
    mysql> UPDATE sum2 SET total= IFNULL(REPLACE(REPLACE(a, '$', ''), ',', ''), 0) + IFNULL((REPLACE(REPLACE(b, '$', ''), ',', '')), 0);
    Query OK, 2 row affected (0.02 sec)
    Rows matched: 2  Changed: 2  Warnings: 0
    
    mysql> SELECT * FROM sum2;
    +--------+--------+-------+
    | a      | b      | total |
    +--------+--------+-------+
    | $1,000 | $2,000 |  3000 |
    | $1,500 | NULL   |  1500 |
    +--------+--------+-------+
    2 rows in set (0.02 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the problem: I have two columns in a table that, for each
Here is my scenario: I have two MySQL tables: Categories (columns: id, category) Items
I have two questions here. How can I show the header of the pop
What is the issue with this code? Here we have two files: classA.h and
My script is here : jsfiddle i have two attributes in my form that
I have two functions here function Preloader() {} Preloader.prototype = { init:function() { //
I have two tables as shown here . I am trying to fetch name
I have two select boxes with dates. See here the jsfiddle: http://jsfiddle.net/egrba/ The people
I have two tables: entitytype and project . Here are the create table statements:
I have two tables, images and image_data and here is an example of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.