我需要在MySQL中实现以下查询.
(select * from emovis_reporting where (id=3 and cut_name= '?????' and cut_name='??') )
intersect
( select * from emovis_reporting where (id=3) and ( cut_name='?????' or cut_name='??') )
Run Code Online (Sandbox Code Playgroud)
我知道相交不在MySQL中.所以我需要另一种方式.请指导我.
我有两个表,记录和数据.记录有多个字段(名字,姓氏等).这些字段中的每一个都是存储实际值的数据表的外键.我需要搜索多个记录字段.
下面是使用INTERSECT的示例查询,但我需要一个在MySQL中工作的查询.
SELECT records.id FROM records, data WHERE data.id = records.firstname AND data.value = "john"
INTERSECT
SELECT records.id FROM records, data WHERE data.id = records.lastname AND data.value = "smith"
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.