Skip to content

Instantly share code, notes, and snippets.

@ranbogmord

ranbogmord/doom.sql Secret

Created Jul 1, 2014
Embed
What would you like to do?
SELECT node.nid AS nid,
node.title AS node_title,
node_data_field_web_order_id.field_web_order_id_value AS node_data_field_web_order_id_field_web_order_id_value,
node.type AS node_type, node.vid AS node_vid,
node.uid AS node_uid,
node_revisions.format AS node_revisions_format,
GREATEST(node.changed, node_comment_statistics.last_comment_timestamp) AS node_comment_statistics_last_updated,
node.created AS node_created, node_data_field_first_name.field_first_name_value AS node_data_field_first_name_field_first_name_value,
node_data_field_last_name.field_last_name_value AS node_data_field_last_name_field_last_name_value,
node_data_field_email.field_email_value AS node_data_field_email_field_email_value,
node_data_field_phone_no.field_phone_no_value AS node_data_field_phone_no_field_phone_no_value,
node_data_field_zip.field_zip_value AS node_data_field_zip_field_zip_value,
node_data_field_address.field_address_value AS node_data_field_address_field_address_value,
node_data_field_city.field_city_value AS node_data_field_city_field_city_value,
node_data_field_delivery.field_delivery_value AS node_data_field_delivery_field_delivery_value,
node_data_field_model.field_model_value AS node_data_field_model_field_model_value,
node_data_field_personal_id.field_personal_id_value AS node_data_field_personal_id_field_personal_id_value,
node_data_field_damage.field_damage_value AS node_data_field_damage_field_damage_value,
node_data_field_delivery.field_kostnad_value AS node_data_field_delivery_field_kostnad_value,
node_data_field_delivery.field_done_value AS node_data_field_delivery_field_done_value,
node_data_field_where.field_where_value AS node_data_field_where_field_where_value,
node_data_field_delivery.field_backrep_value AS node_data_field_delivery_field_backrep_value,
node_comment_statistics.comment_count AS node_comment_statistics_comment_count,
COALESCE(ncs_users.name, node_comment_statistics.last_comment_name) AS node_comment_statistics_last_comment_name,
ncs_users.name AS ncs_users_name, node_comment_statistics.last_comment_uid AS node_comment_statistics_last_comment_uid,
node_data_field_delivery.field_external_order_id_value AS node_data_field_delivery_field_external_order_id_value,
node_data_field_delivery.field_imei_value AS node_data_field_delivery_field_imei_value,
node_data_field_delivery.field_serial_number_value AS node_data_field_delivery_field_serial_number_value,
node.status AS node_status
FROM node node
LEFT JOIN content_field_web_order_id node_data_field_web_order_id ON node.vid = node_data_field_web_order_id.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
LEFT JOIN content_field_first_name node_data_field_first_name ON node.vid = node_data_field_first_name.vid
LEFT JOIN content_field_last_name node_data_field_last_name ON node.vid = node_data_field_last_name.vid
LEFT JOIN content_field_email node_data_field_email ON node.vid = node_data_field_email.vid
LEFT JOIN content_field_phone_no node_data_field_phone_no ON node.vid = node_data_field_phone_no.vid
LEFT JOIN content_field_zip node_data_field_zip ON node.vid = node_data_field_zip.vid
LEFT JOIN content_field_address node_data_field_address ON node.vid = node_data_field_address.vid
LEFT JOIN content_field_city node_data_field_city ON node.vid = node_data_field_city.vid
LEFT JOIN content_type_reparation node_data_field_delivery ON node.vid = node_data_field_delivery.vid
LEFT JOIN content_field_model node_data_field_model ON node.vid = node_data_field_model.vid
LEFT JOIN content_field_personal_id node_data_field_personal_id ON node.vid = node_data_field_personal_id.vid
LEFT JOIN content_field_damage node_data_field_damage ON node.vid = node_data_field_damage.vid
LEFT JOIN content_field_where node_data_field_where ON node.vid = node_data_field_where.vid
LEFT JOIN users ncs_users ON node_comment_statistics.last_comment_uid = ncs_users.uid
AND ncs_users.uid != '0'
WHERE (node.type in ('reparation'))
AND (node.status <> 0) ORDER BY node_created DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.