Jump to content

data888

Members
  • Posts

    12
  • Joined

  • Last visited

  • Days Won

    1

data888 last won the day on June 9 2015

data888 had the most liked content!

Profile Information

  • Gender
    Male

data888's Achievements

Member

Member (2/5)

1

Reputation

  1. By the way.. this finally did execute; there was an issue with the SQL string that was affecting things although there wasn't an error on the screen.
  2. not sure where you are going with this but what is required is that the average field be computed and stored; the issue isn't with performing calculations for display on the screen but the average data does need to be calculated and stored. Each of the fields for the values column are also constantly and randomly updated and not necessarily simultaneously.
  3. Theoretically it seems like that should execute but it doesn't; if you happen to have it execute on your end feel free to discuss. This seems like it should have the capability but the thought was not to spend 5 hours researching it if someone else have utilized this in the past: http://dev.mysql.com/doc/refman/5.6/en/triggers.html
  4. This should help you understand. You get a table with a bunch of values column (value1, value2, value3, value4, value5 and such) . It initially doesn't have an average column and looks like this: ------------------------------------------------------ | value1 | value2 | value3 | value4 | value5 | ------------------------------------------------------- | 10000 | 15000 | 20000 | 25000 | 30000 | ------------------------------------------------------ | 10100 | 15100 | 20100 | 25100 | 30100 | ------------------------------------------------------ | 10200 | 15200 | 20200 | 25200 | 30200 | ------------------------------------------------------ at some stage you then need to also have an 'average' column in the table to compute and store the average of the values. After adding the 'average' column, each row looks like this. All data type for both values and average =int: ------------------------------------------------------------------ | value1 | value2 | value3 | value4 | value5 | average | ------------------------------------------------------------------ | 10000 | 15000 | 20000 | 25000 | 30000 | 0 | ------------------------------------------------------------------ | 10100 | 15100 | 20100 | 25100 | 30100 | 0 | ------------------------------------------------------------------ | 10200 | 15200 | 20200 | 25200 | 30200 | 0 | ------------------------------------------------------------------ So what is needed is to have the average for each of the rows populated based on data in the values fields and should then look something like this: ------------------------------------------------------------------ | value1 | value2 | value3 | value4 | value5 | average | ------------------------------------------------------------------ | 10000 | 15000 | 20000 | 25000 | 30000 | 20000 | ------------------------------------------------------------------ | 10100 | 15100 | 20100 | 25100 | 30100 | 20100 | ------------------------------------------------------------------ | 10200 | 15200 | 20200 | 25200 | 30200 | 20200 | ------------------------------------------------------------------ Do you understand?
  5. It appears I need a trigger of some sort to have a certain function performed. Would like to hear any suggestions on how to have this done. What I need is to have data in a field populated dynamically by calculating the average of other fields within the same table. Example of column names: Value1, Value2, Value3, Value4, Value5, Average Values 1 through 5 may be entered through a form but I need to have the average field populated by dynamically using the entered data to compute the average.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.