/build/static/layout/Breadcrumb_cap_w.png

KACE Product Support Question


Adding two numbers

10/12/2020 119 views

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

Comments

  • Have you tried to cast function? https://mariadb.com/kb/en/cast/
  • 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>)

All Answers

0

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

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

Answered 10/14/2020 by: JordanNolan
9th Degree Black Belt

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