Skip to content

Instantly share code, notes, and snippets.

@macmladen
Last active July 7, 2021 08:34
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 macmladen/173a18ae42d4d95c62d77916ee6542f7 to your computer and use it in GitHub Desktop.
Save macmladen/173a18ae42d4d95c62d77916ee6542f7 to your computer and use it in GitHub Desktop.
Drupal, Radiokarantin.eu: Check which post reference which media
SELECT nid, node_field_data.status, type, FROM_UNIXTIME(node_field_data.created) AS Created, title, field_soundcloud_target_id AS mid, name, field_media_oembed_video_value AS Link
FROM `node_field_data`
LEFT JOIN `node__field_soundcloud` on node_field_data.nid=node__field_soundcloud.entity_id
LEFT JOIN `media__field_media_oembed_video` on field_soundcloud_target_id=media__field_media_oembed_video.entity_id
LEFT JOIN `media_field_data` on field_soundcloud_target_id=mid
WHERE type='article' OR type='episode'
ORDER BY nid DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment