Skip to content

Instantly share code, notes, and snippets.

@MjHead
Created January 27, 2024 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MjHead/28629842ce6455aed80dc3c7d8228357 to your computer and use it in GitHub Desktop.
Save MjHead/28629842ce6455aed80dc3c7d8228357 to your computer and use it in GitHub Desktop.
JetEngine. SQL query to get appointments with service name and service category name. Replace product_cat with your actual taxonomy slug
SELECT app.*, posts.post_title AS service_name, terms.name AS service_category
FROM {prefix}jet_appointments AS app
INNER JOIN {prefix}posts AS posts ON posts.ID = app.service
INNER JOIN {prefix}term_relationships AS terms_rel ON posts.ID = terms_rel.object_id
INNER JOIN {prefix}term_taxonomy AS term_tax ON terms_rel.term_taxonomy_id = term_tax.term_taxonomy_id
INNER JOIN {prefix}terms AS terms ON term_tax.term_id = terms.term_id
WHERE term_tax.taxonomy = 'product_cat'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment