gpt4 book ai didi

mysql - MySQL中如何获取多选语句的交集?

转载 作者:行者123 更新时间:2023-11-30 00:39:46 27 4
gpt4 key购买 nike

我作为一个初学者进行了MySQL的编程。所以我遇到了问题,那就是我必须获得交集作为数学概念。

  $sql = "select code_co.code from code_co 
left join note on note.code = code_co.code
where note like '%cholera%'
and

select code_co.code from code_co
left join note on note.code = code_co.code
where note like '%diarrhea%'
and

select code_co.code from code_co
left join note on note.code = code_co.code
where note like '%fever%'
and
select ....";

在我的代码上方,从代码的多重选择中,如何获得公共(public)交集?很抱歉,我的问题很初级,但我很认真。请帮助我。

最佳答案

尝试这样的事情:

select code_co.code from code_co 
left join note on note.code = code_co.code
where note not in
(select distinct note from note
where note like '%cholera%' or note like '%diarrhea%" or note like '%fever%')

希望这有帮助..

关于mysql - MySQL中如何获取多选语句的交集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21873541/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com