如果您只想知道 Id,则添加关键字 Distinct 并选择 id,其中有三种不同类型的记录...
Select Distinct id
FROM `table` t
WHERE Exists (Select * From Table Where id = t.id and Type = '1')
And Exists (Select * From Table Where id = t.id and Type = '2')
And Exists (Select * From Table Where id = t.id and Type = '3')
如果您想查看 Id 和类型,然后将类型添加到选择中,
Select Distinct id, Type
FROM `table` t
WHERE Exists (Select * From Table Where id = t.id and Type = '1')
And Exists (Select * From Table Where id = t.id and Type = '2')
And Exists (Select * From Table Where id = t.id and Type = '3')
如果您想查看具有该 ID 的每一行,请忽略不同的
Select id, Type
FROM `table` t
WHERE Exists (Select * From Table Where id = t.id and Type = '1')
And Exists (Select * From Table Where id = t.id and Type = '2')
And Exists (Select * From Table Where id = t.id and Type = '3')