2
我有一些街道號存儲爲VARCHAR,但我想在可能的情況下將它們排序爲INT。該語法被接受,但產生的α-排序集合像最大= 53,最小= 1203使用CAST()和MAX()/ MIN()
SELECT `StreetName`,
CAST(MIN(`StreetNumber`) AS UNSIGNED) as min,
CAST(MAX(`StreetNumber`) AS UNSIGNED) as max
FROM `tblAddToLotBridge`
WHERE `LotNumber` = '$item_lotnum'
AND `Primary_Secondary` = 0
GROUP BY `StreetName`
ORDER BY `StreetName`
我試圖嵌套CAST()
的MIN()
/MAX()
內,但該語法得到拒絕。
什麼是正確的DWIM的sytax?
因爲它起作用 – RichardTheKiwi 2011-03-29 19:46:22