11
我想知道是否有辦法在SQL查詢中獲得千位分隔符?MYSQL - 千位分隔符
因爲我有點懶,我想建立可以讓我複製/粘貼的結果對我的老闆不添加這種分離器的請求:d
請求如下:
SELECT COALESCE(Customer, 'TOTAL') AS "Customer", CONCAT(COUNT(SegmentId) , ' bookings') AS "Nb bookings", CONCAT(REPLACE(SUM(Price) , '.', ',') , ' €') AS "Total (€)", CONCAT(ROUND((
SUM(Price)/(
SELECT SUM(Price)
FROM my_db
WHERE CreationDate = CURRENT_DATE()
AND SegmentStatus = "OK") *100) , 2) , ' %'
) AS "PDM"
FROM my_db
WHERE CreationDate = CURRENT_DATE()
AND SegmentStatus = "OK"
GROUP BY Customer
WITH ROLLUP
目前,結果是(表「;」分隔符,對不起,我沒能做出一個表,這個編輯器:():
Customer;Nb bookings;Total (€);PDM
cust_1;20 bookings;20000 €;10,01 %
cust_2;254 bookings;17852,12 €;8,12 %
我要的就是這樣的結果:
Customer;Nb bookings;Total (€);PDM
cust_1;20 bookings;20 000 €;10,01 %
cust_2;254 bookings;17 852,12 €;8,12 %
有沒有辦法做到這一點?
謝謝,
乙
謝謝你,我能夠做到什麼,我想與使用REPLACE(..., ' ''')。謝謝 ! –