2017-08-22 206 views
-1

我必須處理的查詢是這樣的:添加千位分隔符

SELECT some_col FROM some_table WHERE id BETWEEN 0 AND 50000000; 

這將是更容易閱讀的代碼,如果邊界值可以表示不同的,如:

SELECT some_col FROM some_table WHERE id BETWEEN 0 AND 50 000 000; 
SELECT some_col FROM some_table WHERE id BETWEEN 0 AND 50M; 

這可能嗎?

+0

不是沒有被運行查詢時加入了大量的處理開銷。 –

+0

使用REPLACE功能擺脫空間。見下面的答案 – user3127882

回答

0

這工作:

SELECT some_col FROM some_table WHERE id BETWEEN 0 AND REPLACE('50 000 000', ' ', ''); 
SELECT some_col FROM some_table WHERE id BETWEEN 0 AND REPLACE('50M', 'M', '000000');