I have 2 tables.
requests id|code|count| oldrequests id|code|count|
I need to update count in requests from oldrequests. The main problem that I'm trying to update NULL count values with coalesce(oldrequests.count,0) like this:
update request req set count = coalesce(oldreq.count,0) from oldrequests oldreq where req.code = oldreq.code
But NULL values from requests not updating. Then I tried to set NULL values to 0, like this:
update request req set count = 0 from oldrequests oldreq where req.code = oldreq.code and oldreq.id is null
But this didn't help me too. How can I update values and NULL values?</div