Hi,

I have this question, having two numeric values field1 and field2, i need field3 by default to be the difference between field1 and field , any idea??

Recommended Answers

All 2 Replies

in one query:

UPDATE table SET field3 = field1-field2

I think this should work.

(everytime you update/change a value of field1/field2 you will have to do this query, mysql can't do this automatic..)

or you can like be all cool and be like well find the column names and then do it with php $column1 - $ column2

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.