我想從用戶表&他從我connection_history表相關的最後一個記錄的所有數據,這是當我別在我的查詢的末尾添加工作只LEFT JOIN SQL查詢
ORDER BY contributions DESC
(當我添加它,我只有記錄至極來自用戶,而不是最後的connection_history記錄)
我的問題是:我怎麼能得到通過捐助DESC下令entires數據
SELECT * FROM users LEFT JOIN connections_history ch ON users.id = ch.guid
AND EXISTS (SELECT 1
FROM connections_history ch1
WHERE ch.guid = ch1.guid
HAVING Max(ch1.date) = ch.date)
Thx它的工作很好!只需通過捐款改變連接:)! – LeSpotted44