CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    17

    Formula for Record Calculation

    I have created two commands in the database expert. And I want to do the calulation of these records.

    My situation is:

    In table A, I have fields "Country","Amount" and "Currency".
    In table B, I have fields "Currency" and "Exchange".

    I want get the sum of "Amount"*"Exchange" if table A "Currency" = table B "Currency" that group by "Country"

    How to write this formula?

    Thank you fro helping me.

  2. #2
    Join Date
    May 2003
    Posts
    163

    Re: Formula for Record Calculation

    Have u linked these commands by currency?

  3. #3
    Join Date
    Aug 2004
    Posts
    17

    Re: Formula for Record Calculation

    Please tell me how to linkand what I should do after linking?
    Thanks very much

  4. #4
    Join Date
    Aug 2004
    Posts
    17

    Re: Formula for Record Calculation

    I have linked the currency field of two commands.

    My situation is tableB store the currency of all countries in the world. And some of the countries using same currency. If I use a sql statement to join two table, then the records will be duplicated and cannot get the correct exchange rate of each currency.
    So that I want to write a formula that caluclate the tableA amount with correct currency. But I don't know how to get the exchange rate of tableB if tableA.currency=tableB.currency.

    Do you have any idea to do that?
    thanks alot~~~

  5. #5
    Join Date
    Aug 2004
    Posts
    17

    Re: Formula for Record Calculation

    I am using mysql 4.0 which is not supported subquery.

    If you have any idea other than my method. Please tell me. This problem spent me a week ago~

    Really thanks alot~

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured