Posted by rukaya on February 21, 2011 at 7:49am
Hello,
How would I go about using views to build this query below? Is it even possible? Thank you for any help or advice.
SELECT node_revisions.vid AS node_revisions_vid,
node_revisions.nid AS nid,
node.type AS node_type,
node.status AS node_status,
node.created AS node_created,
node.changed AS node_changed,
node_revisions.title AS node_title,
node_revisions.timestamp AS node_revisions_timestamp,
content_field_deadline.field_deadline_value AS field_deadline_value,
term_data.name AS term_data_name,
term_data.description AS term_data_description,
content_field_publisher_deadline.field_publisher_deadline_value AS field_publisher_deadline_value,
content_field_author.field_author_uid AS field_author_uid,
content_field_viewer.field_viewer_uid AS field_viewer_uid,
content_field_approver.field_approver_uid AS field_approver_uid,
content_field_owner.field_owner_uid AS field_owner_uid FROM node_revisions
LEFT JOIN node ON node.nid = node_revisions.nid
LEFT JOIN term_node ON node_revisions.vid = term_node.vid
LEFT JOIN term_data ON term_node.tid = term_data.tid
LEFT JOIN content_field_deadline ON node_revisions.vid = content_field_deadline.vid
LEFT JOIN content_field_publisher_deadline ON node_revisions.vid = content_field_publisher_deadline.vid
LEFT JOIN content_field_author ON node_revisions.vid = content_field_author.vid
LEFT JOIN content_field_viewer ON node_revisions.vid = content_field_viewer.vid
LEFT JOIN content_field_approver ON node_revisions.vid = content_field_approver.vid
LEFT JOIN content_field_owner ON node_revisions.vid = content_field_owner.vid
WHERE node_revisions.vid in (
SELECT max(node_revisions.vid)
FROM node_revisions
LEFT JOIN node ON node.nid = node_revisions.nid
LEFT JOIN term_node ON node_revisions.vid = term_node.vid
LEFT JOIN term_data ON term_node.tid = term_data.tid
LEFT JOIN content_field_author ON node_revisions.vid = content_field_author.vid
LEFT JOIN content_field_viewer ON node_revisions.vid = content_field_viewer.vid
LEFT JOIN content_field_approver ON node_revisions.vid = content_field_approver.vid
LEFT JOIN content_field_owner ON node_revisions.vid = content_field_owner.vid
WHERE (term_data.vid in ("5"))
GROUP BY node_revisions.nid
)
AND
(term_data.vid in ("5"))
AND
(node.type = "page" OR node.type = "news_article" OR node.type = "document" OR node.type = "image" OR node.type = "external_link" OR node.type = "general_event")
AND
(content_field_author.field_author_uid = %d OR content_field_viewer.field_viewer_uid = %d OR content_field_approver.field_approver_uid = %d OR content_field_owner.field_owner_uid = %d)
AND node_revisions.title LIKE '%%%s%%'
ORDER BY node_type ASC
Comments
Existing views all broken
I was using Views 7.x-3.0-alpha1 version .When i updated it into new version 7.x-3.0-beta3,the existing views are broken .Does anyone have any ideas on how to deal with it?