How to compute Kaplan-Meier survival curves in SQL | Hacker News Reader