SELECT r.nid
FROM recipe_node_ingredient r,recipe_ingredient ri
WHERE r.`ingredient_id` = ri.id
AND ri.name = 'carrot'
AND r.nid NOT IN (SELECT r.nid
FROM recipe_node_ingredient r,recipe_ingredient ri
WHERE r.`ingredient_id` = ri.id AND ri.name = 'salt');
此查询将返回一个节点 ID..
此查询还返回一个节点 ID。
SELECT nid
FROM taxonomy_index JOIN taxonomy_term_data USING (tid)
WHERE name IN ('Desert."', 'Indian')
GROUP BY nid HAVING COUNT(*) > 1
是否可以在 MySQL 查询中检查两个返回节点 ID 是否相等..?