Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    9

    Unanswered: Calculating a Local Currency Value

    I've written an Sql statement to extract the Currency Amount and the currency rate and I want to calculate the Amount in Local Currency.

    If the currency amount is in the local currency the Currency rate value returned is 0. I have used a case statement to convert the 0 to 1. (is there
    easier way)

    But I now can't calculate my Local amount value because of the way I have converted the currency rate.

    Select IH.Amount, 'Currency Factor' = CASE
    when
    IH.[Currency Factor] = 0 then 1
    else IH.[Currency Factor]
    end,



    what way should I have written this?

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Ya lost me....

    How about some sample data and what the expected results should be...DDL would be useful as well....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Nov 2003
    Posts
    9
    Geraldine Solved it ..........

    CASE
    WHEN CurFctr = 0 THEN Amount
    ELSE CurFctr * Amount
    END AS Amount

    Thanks Geraldine ... again

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Well...congrats....

    Who's Geraldine?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Wasn't Geraldine Sanford's wife?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •