Churchill
Churchill

Reputation: 81

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 write this as a SQL query

Upvotes: 0

Views: 1371

Answers (1)

Martin Smith
Martin Smith

Reputation: 453648

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.

Upvotes: 3

Related Questions