Querying due cards with SQLite

Hey, you. Can you help with my SQL problem?
I am able to query new cards by opening my database file with SQL browser. However, I am having a hard time querying the due cards. Is there a way to return only the cards due today? I am able to return (I believe) all due cards. I can rephrase my question in case you find it confusing. I am using the following query
SELECT DISTINCT id FROM cards WHERE queue = 2;
It’s returning all due cards of all days. Do you happen to know how can I solve this?

I suggest you look at how Anki queries due cards: anki/sqlwriter.rs at main · ankitects/anki · GitHub
As you can see, it depends on the queue (review, learn, …) and you have to specify the appropriate time.

1 Like

I’m finding it very difficult to implement on my code because I need to run it ouside anki (because I don’t want to depend on wheter or not the software is running) - so I have no idea how to get those variable or even if it’s possible to do this.

Sure, it’s possible, but quite involved and not achievable with SQL alone.

So no way of doing it with SQL only? Because I don’t need the actual cards, just the card count of the day (literally just the number).

https://addon-docs.ankiweb.net/command-line-use.html

1 Like