Skip to content

Instantly share code, notes, and snippets.

View lelandf's full-sized avatar

Leland Fiegel lelandf

View GitHub Profile
@korynorthrop
korynorthrop / sample-learndash-query.sql
Created March 10, 2020 09:19
Inactive LearnDash user SQL query
SELECT u.user_email,
um.meta_key AS "login_type",
from_unixtime(um.meta_value,'%c/%e/%y') AS "login_date",
GROUP_CONCAT(p.post_title) AS "courses"
FROM nPJeAgtL_users u
INNER JOIN nPJeAgtL_usermeta um ON um.user_id = u.id AND um.meta_key = 'learndash-last-login'
LEFT JOIN nPJeAgtL_learndash_user_activity lua ON lua.user_id = u.id AND lua.activity_type = 'course'
LEFT JOIN nPJeAgtL_posts p ON lua.course_id = p.id
WHERE from_unixtime(um.meta_value) < '2019-03-01 00:00:00' AND p.id IN (1947,1938,7694,1932)
GROUP BY u.user_login