实际应用中是这样的:
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)时,查询较慢,有什么改进的办法。
我是新手。
哦,是的,我上面写错了。是:
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')