如何使用SQL查询检索Drupal分类法?

时间:2013-08-25 17:39:17

标签: sql drupal-7 ubercart

我使用 Drupal 7 Ubercart 3 开发了一个音乐商店,我正在使用 JasperReports iReport )建立报告。我正在检索属于某个节点的taxonomy_index表中包含的多个Taxonomy术语,因此我可以在报告中显示。

例如,节点id 13有3个术语。

enter image description here

我的挑战是我当前的查询只显示一个术语。您可以帮助我查询以显示更多条款。

SELECT
     taxonomy_term_data.`name` AS taxonomy_term_data_name,
     taxonomy_vocabulary.`name` AS taxonomy_vocabulary_name,
     uc_order_products.`qty` AS uc_order_products_qty,
     uc_order_products.`price` AS uc_order_products_price,
     node.`type` AS node_type,
     node.`title` AS node_title,
     uc_orders.`created` AS uc_orders_created
FROM
     `uc_order_products` uc_order_products INNER JOIN `node` node ON uc_order_products.`nid` = node.`nid`
     INNER JOIN `taxonomy_index` taxonomy_index ON node.`nid` = taxonomy_index.`nid`
     INNER JOIN `taxonomy_term_data` taxonomy_term_data ON taxonomy_index.`tid` = taxonomy_term_data.`tid`
     INNER JOIN `taxonomy_vocabulary` taxonomy_vocabulary ON taxonomy_term_data.`vid` = taxonomy_vocabulary.`vid`
     INNER JOIN `uc_orders` uc_orders ON uc_order_products.`order_id` = uc_orders.`order_id`
WHERE
     taxonomy_term_data.`tid` = 11

0 个答案:

没有答案