0

I have an SQL querry that creates a comparison table based on taxonomy and am wondering if it is possible to recreate using Views??

If a node has a taxonomy it selects the node tile and 'Y' else 'N' A sample of the SQL code is:

enter code here

select a.title AS SOFTWARE,
COALESCE((select 'Y'
from taxonomy_index b, taxonomy_term_data c
where c.tid = b.tid
and c.vid = 3
and b.tid = 17
and a.nid = b.nid), 'N') AS 'Results Recorded',
COALESCE((select 'Y'
from taxonomy_index b, taxonomy_term_data c
where c.tid = b.tid
and c.vid = 3
and b.tid = 13
and a.nid = b.nid), 'N') AS 'Free Trial'
from node a
where a.type = 'Software'

Many Thanks Julie

0

Building this query in Views impossible, but you can use PHP code (for example, views_php, views_customfield, viewsphpfilter) or just templating fields in Views for making dynamic calculations.

  • Thanks for the information, I have installed views_php but I am not sure how I use it to get the desired results. My SQL is poor and my PHP is worse. Could you point me to an example of how I would use views_php to implement the above query. – julie May 23 '12 at 22:41
  • I am repeat, doing your sql is impossible. You should just query your nodes with taxonomy, then write code in PHP for calculation Y and N... – Nikit May 23 '12 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.