Created
November 20, 2012 19:53
-
-
Save kevinchampion/4120594 to your computer and use it in GitHub Desktop.
Discount search query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
discount search query: | |
SELECT DISTINCT n.nid, n.title, n.created, m.field_discount_long_description_value, x.expire, | |
p.title p_title, p.created, q.body, p.nid pnid, 1 target_count, (SELECT COUNT(t.nid) FROM {term_node} t WHERE t.nid = n.nid AND t.tid = %d) category_count | |
FROM {term_data} d INNER JOIN {term_node} t on t.tid = d.tid LEFT JOIN {node} n | |
on t.nid = n.nid INNER JOIN {content_type_mcard_discount} m on n.vid = m.vid INNER JOIN {node} p on | |
m.field_discount_provider_nid = p.nid INNER JOIN {node_revisions} q | |
on p.vid = q.vid INNER JOIN {node_expire} x on x.nid = n.nid WHERE (n.type = 'mcard_discount' AND n.status = 1 ) HAVING | |
target_count >= 1 AND category_count >= 1 ORDER BY p.title | |
Array | |
( | |
[0] => 6 | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT n.nid, n.title, n.created, m.field_discount_long_description_value, x.expire, | |
p.title p_title, p.created, q.body, p.nid pnid, 1 target_count, 1 category_count | |
FROM {term_data} d INNER JOIN {term_node} t on t.tid = d.tid LEFT JOIN {node} n | |
on t.nid = n.nid INNER JOIN {content_type_mcard_discount} m on n.vid = m.vid INNER JOIN {node} p on | |
m.field_discount_provider_nid = p.nid INNER JOIN {node_revisions} q | |
on p.vid = q.vid INNER JOIN {node_expire} x on x.nid = n.nid WHERE (n.type = 'mcard_discount' AND n.status = 1 ) HAVING | |
target_count >= 1 AND category_count >= 1 ORDER BY p.title | |
Array | |
( | |
) |
vkareh
commented
Dec 5, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment