table1
id1
1
2
3
4
table2
id1 id2
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3两表关联,找出id2为1 & 2 & 3的所有id1,要经得起压力测试,数据量100万
id1
1
2
3
4
table2
id1 id2
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3两表关联,找出id2为1 & 2 & 3的所有id1,要经得起压力测试,数据量100万
解决方案 »
- 请问怎样设计用户权限管理?
- csv文件导入MYSQL数据库问题!
- load data infile有没有能够替代insert into ... on duplicat key update `c`=`c`+`1的方法?
- 求教关于建表语法问题
- mysql_connect时指定数据库名为空,而在sql语句中指明数据库的方式是否线程安全?
- Linux下如何使java读取mysql的内容?(急!急!急!解决后立即送分!!!)
- 请教一条SQL语句
- mysql视图创建问题
- mysql 怎么实现按照汉子首字母检索数据
- SQLSTATE[HY000] [1045] Access denied for user 'root'@'120.92.161.238' (using pas
- 开启MYSQL 常用查询日志需要注意的问题。
- 有那位高手知道为什么用select * from table_name where birth="841204" 和select count(*) from table_name where birth="841204"他们显示的记录条数不同 急!!!!
select id1 from table2 where id2=2 group by id1 order by id1;
select id1 from table2 where id2 in (1,2,3);
我现在是用别名的方法实现的:
select a.id1 from table2 a,table2 b,table2 c where a.id2=1 and b.id2=2 and c.id2=3 and a.id1=b.id2 and b.id1=c.id1
这样关联起来的表比较多,由于数据本身很大,而且还有其他的表、其他条件,所以速度很慢,能不能帮忙改进一下,谢谢!