SQLite Forum

How to convert to CTE
Login
> I noticed counts seem only to go up by date

Shouldn't it? I thought you were interested in the cumulative totals of registered people over time. That's why we ask about stating your question in English - it is not obvious to me that the totals shouldn't only go up.

> but that can't be right as the number of registered patients can go down (and do go down) as patients die or leave.

So what is it that you want to see for each day then?  Only the people that are currently registered when that day rolls by? for every day? I can do that too, but your query that you gave originally wouldn't do that correctly.

Would the question statement then become: Give a list of the total number of people that are registered at the time (having already registered, but not yet left or died) for each day along the date range?

You keep giving feedback about how "close" the query is or what doesn't seem "right" with it, in stead of just saying what it is you want. we keep trying to guess what you want and offering possible question statements trying to define what you need from the query, and you keep ignoring it. Pretty please, with sugar on top, tell me what is wrong with the question statement I gave above, or put what you want in your own words in simple English so that there can be no doubt what you wish to see from that query. You obviously have a clear idea of what you want, if only you can explain that idea fully to us. Explain it like I'm 5 years old. :)

Perhaps you assume the query needs to be advanced or difficult - let me say that making the query is extremely easy once you can state your question in plain English. Understanding what you really want from the query is the only difficult part.

Also, it's really hard to test without some proper data, so that plan to upload some data is a good idea. Perhaps add it to a file host site and post the link? Box or Drop-box or such will do.