MySQL Forums
Forum List  »  Newbie

Updating with NULL values + numbers
Posted by: Yarick Glodov
Date: February 26, 2012 05:55PM

Good day,

Here is a query:
update rents as r set r.Debt = r.Deposit - (select sum(e.Total) from rents_extend as e where e.RentId = r.Id) + (select sum(f.Fee) from rents_fee as f where f.RentId = r.Id);

Not in all times in rents_extend or rents_fee we have rows, so usually one of these values is NULL.
I cannot use isnull() function here, because it is subquery.
How can I deal with it?

Options: ReplyQuote


Subject
Written By
Posted
Updating with NULL values + numbers
February 26, 2012 05:55PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.