我正在连接一些表,并希望根据表中的ENUM列过滤结果,该表的值为0.1。
这是查询。
SELECT dpc.`id` AS parent_id,
dpc.`name` AS parent_name,
cp.`id` AS child_id,
cp.`name` AS child_name,
cp.`stub` AS stub,
cp.`active` AS active,
caf.`aspect_id` AS aspect_id,
am.`name` AS aspects,
GROUP_CONCAT( nfw.`aspect_values`) AS aspect_childs
FROM `category_parent` AS cp
JOIN `deals_parent_cat` AS dpc ON cp.`parent_id` = dpc.`id`
JOIN `category_aspect_filters` AS caf ON caf.`cat_id` = cp.`id`
JOIN `aspect_master` AS am ON am.`id` = caf.`aspect_id`
LEFT JOIN `navigation_filters_weightage` AS nfw ON nfw.`cat_id`= cp.`id`
AND nfw.`aspect_id` = am.`id` AND cp.`active`="1"
GROUP BY parent_id,child_id,aspect_id
ORDER BY parent_name,cp.`order`,aspects
我已将条件放在查询中,只返回那些cp.active="1"
的结果,但仍然会得到值为“0”的列。
这是输出:
请你帮忙解决查询中可能出错的问题。
答案 0 :(得分:1)
这是您的查询
AND nfw.`aspect_id` = am.`id` AND cp.`active`="1"
也许试试这个
where nfw.`aspect_id` = am.`id` AND cp.`active`="1"