I want to deduct a certain amount from a column's data
I want to deduct Rs 300 from totalfee column in every row
How do I writ开发者_如何学Goe this as a SQL query
Assuming that you want to modify the actual data
UPDATE yourtable
SET totalfee =totalfee - 300
If this is just for a select
SELECT totalfee - 300 AS fee_post_deduction
FROM yourtable
Both of these can give negative fees if you currently have any totalfee
values less than 300 of course.
精彩评论