/build/static/layout/Breadcrumb_cap_w.png

Adding two numbers

HI folks 

I think I have asked this question before. I am trying to multiply a quantity field by a cost field to give a total cost. The fields are text as you can only have an integer arithmetic value (and cost and total cost will be a $$.cc format)  

Has anyone done something similar. what might the SQL look like? 





2 Comments   [ + ] Show comments
  • Have you tried to cast function? https://mariadb.com/kb/en/cast/ - chucksteel 11 months ago
  • got this to work. Next step is to work out how to update the Asset record.

    update HD_TICKET
    Set HD_TICKET.CUSTOM_FIELD_VALUE21 =
    (
    ( CONVERT(CUSTOM_FIELD_VALUE16, decimal(10,2)) * CONVERT(CUSTOM_FIELD_VALUE17, decimal(10,2)))
    + ( CONVERT(CUSTOM_FIELD_VALUE19, decimal(10,2)) * CONVERT(CUSTOM_FIELD_VALUE20, decimal(10,2)))
    )
    where
    HD_TICKET.ID in (<TICKET_IDS>) - kiwiblue 11 months ago

Answers (1)

Posted by: JordanNolan 11 months ago
9th Degree Black Belt
0

Try CAST.  Here is a link that will let you test your formula to

https://www.w3schools.com/sql/func_mysql_cast.asp

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ