我有一个问题。当我运行数据库查询时,结果是空集。但我在数据库中有很多数据。如果我加入两个名称,如品牌和城市,我得到了所需的结果。但如果多次加入,我得到了空集。我怎么能这样做呢?
SELECT n.nid,
ttdbrand.name as brand,
ttdcity.name as city,
cp.product_id,
n.title as model,
ttdsize.name as display_size,
ttdram.name as ram
FROM node as n
INNER JOIN
taxonomy_term_data as ttdbrand
INNER JOIN
field_data_field_brand as fbrand
INNER JOIN
field_data_field_product as fdfp
INNER JOIN
commerce_product as cp
INNER JOIN
field_data_field_city as fcity
INNER JOIN
taxonomy_term_data as ttdcity
INNER JOIN
field_data_field_display_size as fsize
INNER JOIN
taxonomy_term_data as ttdsize
INNER JOIN
field_data_field_ram as fram
INNER JOIN
taxonomy_term_data as ttdram
ON n.nid=fbrand.entity_id
AND fdfp.field_product_product_id =cp.product_id
AND fdfp.entity_id=n.nid
AND ttdbrand.tid=fbrand.field_brand_tid
AND fbrand.entity_id=n.nid
and n.nid=fcity.entity_id
and ttdcity.tid=fcity.field_city_tid
and ttdsize.tid=fsize.field_display_size_tid
and n.nid=fsize.entity_id
and ttdram.tid=fram.field_ram_tid
and n.nid=fram.entity_id
ORDER BY cp.product_id