sql - How to create a column in MYSQL which automatically SUMs the values from other columns within the same row -


Can someone tell me whether it is possible to have a column in MYSQL in the table, which is automatically assigned to a given device For SUM function does the number of columns

As a comparative example in Microsoft Excel, it is possible to have a cell that SUM functions for cells of a particular category and automatically updates ie (= SUM E4 : E55)

Is there a column that gets the same function in MYSQL?

To expand more -

I have several types of columns that are related to different sizes of our products i.e., quantity_size _ * and want A column that will be the value of the quantity column and automatically updates if any price has changed.

Any advice will be great thanks

Normally you can do this Do not fly-in-fly and do not store them in your chosen query.

  select some_calumn, col1 * col2 as your_table some_calculation_result  

but if you have a good reason to do so, then you can use it Triggers to calculate those data.

You need an Update Trigger to capture a entry trigger to calculate the change in the data and the entry.

An example of an entry trigger is such that

  delimiter. For each line, create the sum sum_trigger after INSTER on your_table. Start NEW.sum_column = NEW.column1 * NEW.column2; End Limiter;  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -