以下查询:from readings t inner join (select code, min(date) as MinDatewhere date >= "2018-11-1"在一秒内返回。另外,如果使用整个查询并将min()替换为max(),也只需要一秒钟。
我使用的是HeidiSQL,奇怪的是它报告
每次我添加以下代码时,它的运行速度都非常慢。disconnect()cmd=New Odbc.OdbcCommand("SELECT idnum FROM tblmanhours GROUP BY idnum HAVINGe.CellStyle.ForeColor = Color.White End If上面代码的输出是正确的,但是每次我调试它的时候它的运行速度都非常慢
查询如下:SELECT id, (SELECT name from cities WHEREstate_id FROM cities WHERE id=adr.city_id limit 1) limit 1), FROM addresses adr
因为数据保存在其他表中,所以我必须使用所有这些子查询,这会使它慢很多。