如何在PHP codeigniter中将元组查询从“或”转换为“和”操作

时间:2016-10-04 14:35:37

标签: mysql sql tuples

SELECT 
 `reference_of_common` 
FROM `tbl_taxonomic_character` 
WHERE
(root_character,character_sub1) IN (
                                  ('habit','Climber'),
                                  ('floral type','pentamerous')
                                 )
group by reference_of_common; 

此查询用作OR操作。如何编写AND操作的查询?

请帮帮我

1 个答案:

答案 0 :(得分:0)

尝试使用

SELECT 
 `reference_of_common` 
FROM `tbl_taxonomic_character` 
WHERE
(root_character,character_sub1)IN(
                                  ('habit','Climber'),
                                  ('floral type','pentamerous')
                                 )
group by reference_of_common having COUNT(DISTINCT root_character)>1 ;