Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2006
    Posts
    162

    Unanswered: Table Field from Calculation

    I'm drawing a blank after a long day. I can't remember how to update a table with a value using 3 other fields to do a calc.
    Ex.
    Table has 4 Fields
    A
    B
    C
    D

    Lets say A, B, and C are given.

    I want to update the Field D to =(A/B)*C

    I've done something like this before, but its been a while and I can't think right now.

    TIA

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    The short answer is to run an UPDATE query.
    BUT, do you have a good reason for violating 3NF?
    Me.Geek = True

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select A, B, C, (A/B)*C as D from daTable
    save this as a query, then write your queries against the stored query, not the table

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Sep 2006
    Posts
    162
    D is gonna be a value in a crosstab. I would have to have append the data to another table then run the crosstab if I used a query.

    What I have is a unit price and a total price. I want to have a quantity added the same table by just calc total price/unit price
    Last edited by Jay59; 06-14-07 at 19:20.

Posting Permissions

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