我有這樣的SQL查詢:SQL命令與加盟
SELECT b.topbid, b.topdate, a.*
FROM auction_items a
LEFT JOIN
(SELECT itemID, MAX(bid) as topbid,
MAX(date) as topdate FROM auction_bids GROUP BY itemID) b
ON a.id = b.itemID
ORDER BY b.topdate DESC, a.date DESC LIMIT 20
這不是訂購如何我想它。我想通過合併b.topdate
和a.date
來訂購。
出了什麼問題?
你這是什麼意思是通過合併'a.topdate'和'b.date'「的順序? – 2012-02-22 19:22:30
所以如果b.topdate高於a.date,它會高於它。 – user1022585 2012-02-22 19:23:11
然後它看起來就是你所做的:'按b.topdate desc,a.date desc'命令。 – 2012-02-22 19:25:00