SELECT *, REPLACE(number_option, 'Issue ', '') AS new_number_option FROM
jgl_article WHERE status = 1 AND topic = 'Current Issues' ORDER BY id ASC
new_number_option列返回:MySQL的 - 從虛擬列中獲取最高價值
1
1
1
2
2
3
3
我想從new_number_option列的最高值。這裏3是最高值。所以,我想獲得包含最高價值的記錄。我在上面的查詢中嘗試了HAVING MAX(new_number_option)。但是,它不會起作用。
它ONL返回第一行年。它不會返回包含最高值 – Karuppiah
SELECT *行, MAX(CAST(REPLACE(number_option, '問題', '')爲unsigned))AS new_number_option FROM jgl_article WHERE狀態= 1 AND主題=「當前問題' –
試試這個查詢@Beginner –