I have a rank system on my Discord bot, and I am trying to display a message like ('You are rank #5') So I need to query my database, but I am not that great with SQL (I use better-sqlite3) What I have tried is evidently wrong. Can someone help me, please? My attempt:
const userRank = db.prepare('SELECT count(*) FROM scores WHERE points <= 113 AND guild = ? ORDER BY points DESC').all(message.guild.id);
console.log(userRank);
I would like the console.log to output '5' in this case but the current output says '1' (check photo for database records)