SELECT u.ID as uid, u.display_name, cast(m4.meta_value as datetime) as last_activity, 99999 as distance,
CASE
WHEN u.display_name LIKE '% %' THEN right(u.display_name, length(u.display_name)-locate(' ', u.display_name))
ELSE u.display_name
END AS surname
FROM wp_users u
LEFT JOIN wp_usermeta m4 ON u.ID = m4.user_id
WHERE
m4.meta_key = 'symposium_last_activity' AND
(u.display_name IS NOT NULL) AND
(
(lower(u.display_name) LIKE 'q%')
)
ORDER BY cast(m4.meta_value as datetime) DESC
LIMIT 0,1000
No members found....
Sign up for The Wish Builder Member Forum and you can participate, contribute and enjoy all of the information & support as part of this member forum.