查询较慢

[复制链接]
查看11 | 回复2 | 2005-2-28 12:57:00 | 显示全部楼层 |阅读模式
实际应用中是这样的:
Select B.fieldB,B.fieldC From tableA A,tableB B where B.fieldE='123' and A.FieldA=(select max(A.FieldA) FromtableA A,tableB B where B.fieldE='123')
当该两表的记录很大(大概有500,000)时,查询较慢,有什么改进的办法。
我是新手。
回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
你的子查询select max(A.FieldA) From tableA A,tableB B where B.fieldE='123'
中缺少了A与B的关联条件.
回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
哦,是的,我上面写错了。是:
Select B.fieldB,B.fieldC From tableA A,tableB B where A.fieldD=B.fieldD AndB.fieldE='123' and A.FieldA=(select max(A.FieldA) From tableA A,tableB B whereA.fieldD=B.fieldD AndB.fieldE='123')
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行