Soluzioni di Fetch per utente

Ciao!

Ho cercato in tutto il forum e ho anche sviluppato un po’ da solo, ma non riesco a creare una query per recuperare tutti gli utenti con il numero di soluzioni fornite da ciascuno in un determinato periodo. Grazie per l’aiuto!

3 Mi Piace

You can get solved topics from the user_actions table. Solved topics in that table have their action_type set to 15.

Here’s a general query for getting solved counts for users within a given time period. You’ll need to set the start_date and end_date parameters before running the query. Those parameters should be in the form of yyyy-mm--dd. For example 2020-02-18.

--[params]
-- date :start_date
-- date :end_date

SELECT
user_id,
COUNT(user_id) AS solved_count
FROM user_actions
WHERE created_at::date BETWEEN :start_date AND :end_date
AND action_type = 15
GROUP BY user_id
ORDER BY solved_count DESC
6 Mi Piace