Hi all,

I have a query that is not quite producing what I expected:

select
  n.nid,
  n.title,
  DATE_FORMAT(FROM_UNIXTIME(n.created), '%c/%e/%Y') as created,                 
  c.field_product_price_value as price,
  d.name,
  t.tid,
  v.value AS vote_average
from
  node n
  left join node_revisions r on r.vid = n.vid
  left join content_type_galleria_product c on c.nid = n.nid
  left join term_node t on t.nid = n.nid
  left join term_data d on d.tid = t.tid
  right join votingapi_cache v on v.content_id = n.nid
WHERE
  n.type = 'galleria_product' AND
  v.function = 'average' AND
  t.tid = 22;


This query produces one result:

nid             1391
title           The Omnivore's Dilemma
created         12/12/2007      
price           21.99
name            Books, DVDs
tid             22
vote_average    80


However, I was expecting two rows to be returned. The issue is that the second record does not have an entry in the votingapi_cache table. I used a right join on that table, expecting to get the record back with a NULL in the vote_average column, but that didn't happen.

How can I get both records to be found?

-Erich-





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to