我有2个表,Worker和Worker_Balance:
--------------- ------------------
| Worker | | Worker_Balance |
|-------------|<----------|----------------|
| | | INT workerBID |
| ... | | INT amount |
--------------- | INT workerID |
| DATE timestamp |
------------------
以及以下sql-query:
SELECT Worker.ID, Worker.xy, SUM(Worker_Balance.amount)
FROM Worker
JOIN Worker_Balance ON WorkerBalance.workerID = Worker.workerID
GROUP BY Worker.ID, Worker.xy
我需要按最新时间戳排序的结果,但最旧的必须是第一个。因此,最后一笔交易最早的工人是第一位。