Skip to content

Instantly share code, notes, and snippets.

@mdalaminbey
Created July 23, 2023 07:25
Show Gist options
  • Select an option

  • Save mdalaminbey/150fe7c8836bf5bc7da3cbfddbd63bcb to your computer and use it in GitHub Desktop.

Select an option

Save mdalaminbey/150fe7c8836bf5bc7da3cbfddbd63bcb to your computer and use it in GitHub Desktop.
(
SELECT
users.ID AS id,
user_email AS email,
"registered" AS user_type,
user_registered AS created_at
FROM
wp_users AS users
WHERE
EXISTS(
SELECT
1
FROM
wp_helpgent_responses AS responses
WHERE
responses.created_by = users.id
LIMIT 1
)
)
UNION ALL
(
SELECT
guests.id,
guests.email,
"guest" AS user_type,
created_at
FROM
wp_helpgent_guest_users AS guests
)
ORDER BY
created_at
DESC
LIMIT 10 OFFSET 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment