Skip to content

Instantly share code, notes, and snippets.

@alaahd
Created August 24, 2013 11:52
Show Gist options
  • Save alaahd/6327693 to your computer and use it in GitHub Desktop.
Save alaahd/6327693 to your computer and use it in GitHub Desktop.
SELECT node.nid AS nid,
node_data_field_main_image.field_main_image_fid AS node_data_field_main_image_field_main_image_fid,
node_data_field_main_image.field_main_image_list AS node_data_field_main_image_field_main_image_list,
node_data_field_main_image.field_main_image_data AS node_data_field_main_image_field_main_image_data,
node.language AS node_language,
node.type AS node_type,
node.vid AS node_vid,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format,
node_comment_statistics.comment_count AS node_comment_statistics_comment_count,
node.title AS node_title,
users.name AS users_name,
users.uid AS users_uid,
node_data_field_op_video_thumbnail.field_op_video_thumbnail_fid AS node_data_field_op_video_thumbnail_field_op_video_thumbnail_fid,
node_data_field_op_video_thumbnail.field_op_video_thumbnail_list AS node_data_field_op_video_thumbnail_field_op_video_thumbnail_list,
node_data_field_op_video_thumbnail.field_op_video_thumbnail_data AS node_data_field_op_video_thumbnail_field_op_video_thumbnail_data,
node_revisions.teaser AS node_revisions_teaser,
node_data_field_caption_teaser.field_caption_teaser_value AS node_data_field_caption_teaser_field_caption_teaser_value,
node_data_field_caption_title.field_caption_title_value AS node_data_field_caption_title_field_caption_title_value,
node.created AS node_created
FROM node node
LEFT JOIN content_field_features_options node_data_field_features_options ON node.vid = node_data_field_features_options.vid
LEFT JOIN content_field_features_video_options node_data_field_features_video_options ON node.vid = node_data_field_features_video_options.vid
LEFT JOIN term_node term_node ON node.vid = term_node.vid
INNER JOIN term_data term_data ON term_node.tid = term_data.tid
LEFT JOIN content_field_main_image node_data_field_main_image ON node.vid = node_data_field_main_image.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
INNER JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid
INNER JOIN users users ON node.uid = users.uid
LEFT JOIN content_type_video node_data_field_op_video_thumbnail ON node.vid = node_data_field_op_video_thumbnail.vid
LEFT JOIN content_field_caption_teaser node_data_field_caption_teaser ON node.vid = node_data_field_caption_teaser.vid
LEFT JOIN content_field_caption_title node_data_field_caption_title ON node.vid = node_data_field_caption_title.vid
WHERE ((node.type in ('article', 'video')) AND (node.status <> 0) AND (term_data.name = 'Going Out'))
AND (((node_data_field_features_options.field_features_options_value IN ('FEATURES MAIN', 'FEATURES SUB')) AND (node_data_field_features_options.vid IS NOT NULL)) OR ((node_data_field_features_video_options.field_features_video_options_value IN ('FEATURES MAIN', 'FEATURES SUB')) AND (node_data_field_features_video_options.vid IS NOT NULL)))
ORDER BY node_created DESC
LIMIT 0, 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment