I have 3 columns:
grossWeight | tare | netWeight
the value of the first two fields will decide the value of the third field:
grossWeight | tare | netWeight
50 40 ?
i want the follow... grossWeight - tare = netWeight
grossWeight | tare | netWeight
50 40 10
how can i reach that with SQL ?
You cqn do it with something like:
update yourTable set netWeight = grossWeight - tare;
Consider to use triggers for more flexibility: when using a trigger you can configure it to be automatically excuted when grossWeight
and/or tare
are inserted or updated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.