我有两个表,aaa和bbb。
现在,我想查询bbb里的字段date>123232432的id,在aaa里的同样ID的password记录数,我这样写SQL:select t1.id t1.password from aaa as t1,bbb as t2 where t2.password<123232432;为什么查询后机器就死了,是不是写错了?记录也不多就80000条左右。请高手指教,谢谢!
现在,我想查询bbb里的字段date>123232432的id,在aaa里的同样ID的password记录数,我这样写SQL:select t1.id t1.password from aaa as t1,bbb as t2 where t2.password<123232432;为什么查询后机器就死了,是不是写错了?记录也不多就80000条左右。请高手指教,谢谢!
解决方案 »
- mysql游标中使用select语句时不循环的问题
- com.mysql.jdbc.CommunicationsException: Communications link failure
- ERROR 1206 (HY000): The total number of locks exceeds the lock table size
- mysql 怎么实现这个功能?
- 新手问用ODBC连接的问题
- 郁闷,又是驱动包错误
- php 连接postgresql的问题
- mysql 导入导出某个指定的表
- mysql分布式操作问题
- sql语句怎么拼接出来
- 设计一张表,想让begintime 小于 endtime,请问怎么样的语法
- 存储过程的问题
现在,我想查询bbb里的字段date>123232432的id,在aaa里的同样ID的password记录数,我这样写SQL:select t1.id t1.password from aaa as t1,bbb as t2 where t2.password<123232432;为什么查询后机器就死了,是不是写错了?记录也不多就80000条左右。请高手指教,谢谢!
select * from aaa where id in (select id from bbb where date>123232432)
2、你原来的PASSWORD字段有没有加索引?
推荐
select t1.id t1.password from aaa as t1,bbb as t2 where t2.password<123232432 and t1.id = t2.id;