发布网友 发布时间:2022-04-09 12:34
共2个回答
热心网友 时间:2022-04-09 14:03
你sql里面全是select * ,这在数据量大的表里运行一次对数据库绝对是个不小的打击追问是的 大量数据的时候。直接卡死。
热心网友 时间:2022-04-09 15:21
*改成你需要的列试试追问没用的。用了2个嵌套的子查询 最里面的查询起始 是把所有数据都取出来了。追答SELECT *,COUNT(a.verifyTime) AS total
FROM a
INNER JOIN b ON (b.aid=a.id AND b.fid=2)
LEFT JOIN c ON (c.bid=b.id)
LEFT JOIN d ON (d.bid=b.id)
LEFT JOIN e ON (e.id=b.eid AND e.fid=b.fid)
LEFT JOIN f ON (f.id=b.fid AND f.id=e.fid)
group by b.id,a.id AS aid,a.userName,a.statusType AS authorStatusType,
f.name,e.typeName,b.days,b.openTime,b.endTime,b.statusType,b.quantity,
c.id AS cid,c.superior,c.vendition,c.remarks,c.time,d.id AS did,
d.loginTime,d.verifyTime,d.ip
ORDER BY c.time DESC,d.loginTime DESC,d.verifyTime DESC