How do I generate static dates for the null rows that come in as closed?

  Kiến thức lập trình
ID Status datecol
1 closed 2024-04-18
2 closed 2024-04-12
3 closed NULL
4 closed NULL

Let say Id 3 came in as closed on 2024/4/19 with datecol null, How can i populate it with the date it came in as closed(in this case: 2024/04/19). And what if id 4 was to come in five (5) days after Id 3 with datecol null, How would I populate it with 2024/04/24.

Here is what I tried:
Case when status = “closed” and datecol is null then getdate() else datecol end as dateecol.

New contributor

Kofisam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT