Mulpliplcation of all values in a column plus converting negative values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bengevik
    New Member
    • Jul 2008
    • 2

    Mulpliplcation of all values in a column plus converting negative values

    I need to multiplicate all the values in a coloumn with a constant and returning them in a (eventually new) column.

    My second problem is that there are negative values in some rows. I need to convert these values in this way:
    6,28 - (value)
    into positive values.

    Is there any functions for these operations and how will it look like?
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    Multiply by a constant
    [code=sql]
    select 6*Field1,12*Fie ld2
    From yourtable
    [/code]

    Field sometimes negative
    [code=sql]
    select case when Field1<0 then 3200-Field1 else 6*Field1 end as Field1
    From YourTable
    [/code]

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      You can also use this function.

      Happy coding.

      -- CK

      Comment

      • bengevik
        New Member
        • Jul 2008
        • 2

        #4
        Danke sehr.

        I do have one more problem: how can I convert a text field containing only numbers to a number field?

        Comment

        • Delerna
          Recognized Expert Top Contributor
          • Jan 2008
          • 1134

          #5
          the function "convert" is used to convert fields from one data type to another in a query. Check the help files

          Comment

          Working...