mysql 求一查询 表达式/思路 新手求助;存在一个记录实体a和实体b的关系表(3 columns):‘id,a,b’. 如何查询至少具有b=x,b=y,b=z.......的a。(除了自我join 的方法,由于关系表太大,多次连接数据库会挂) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select afrom tbwhere b in ('x','y','z')group by a having count(distinct b)=3 select from 关系表 twhere b=xand exists (select 1 from 关系表 where a=t.a and b=y)and exists (select 1 from 关系表 where a=t.a and b=z) 我也是这么想的但是没解决b重复问题,原来distinct 还可以用这个位置,学习了。 这个效率比起#2会更高吗?(假设会有很多Item,不止x,y,z)Thanks in advance mysql有没有类似sum一样的*=函数 windows7 中如何使用myODBC 关于批量update的问题 关于mysql的聚簇索引,请教! 版本不支持子查询,怎样将纵向数据查询出来横向显示 问个问题,散个小分,关于数据库信息采集方面的 mysql数据库导出导入问题?? 关于时间的查询问题!? 请问mysql里建表是当数据类型是int时,它的默认length/set是3。这个3是指字节数还是字符数阿? 怎样对 mySQL 使用? mysql中主键、自增长问题 求解 sql 两表相减 在线等谢谢
from tb
where b in ('x','y','z')
group by a
having count(distinct b)=3
select
from 关系表 t
where b=x
and exists (select 1 from 关系表 where a=t.a and b=y)
and exists (select 1 from 关系表 where a=t.a and b=z)
这个效率比起#2会更高吗?(假设会有很多Item,不止x,y,z)
Thanks in advance