這是我的程序在輸出中有$不會打印。 我會用正確的了Syntex爲「$」 +,但它不工作
SELECT USERS.ID,CONCAT(USERS.FIRSTNAME,' ',USERS.LASTNAME)AS USERNAME,
('$'+ SUM(CPS_HISTORY.CHARGED_AMOUNT+CPS_HISTORY.TRANSACTION_FEE+CPS_HISTORY.SERVICE_CHARGE+CPS_HISTORY.COMBO_PAK_PRICE))AS REVENUE FROM USERS JOIN CPS_HISTORY ON CPS_HISTORY.SUBSCRIBER_ID = USERS.ID GROUP BY USERS.ID ORDER BY REVENUE DESC LIMIT 5;
+---------+---------------+---------+
| ID | USERNAME | REVENUE |
+---------+---------------+---------+
| 1803399 | Michael Rowan | 772 |
| 1697091 | NULL | 676 |
| 1790000 | ree Green | 626 |
| 1766654 | Jose M NUFIO | 625 |
| 1731854 | Ashlee Durgin | 622 |
+---------+---------------+---------+
5 rows in set, 13305 warnings (0.15 sec)
與concat函數的問題是:改變的數據。
+---------+-----------------+---------+
| ID | USERNAME | REVENUE |
+---------+-----------------+---------+
| 1753814 | Joseph Hearn | $99 |
| 1806377 | Gideon Anderson | $99 |
| 1800992 | Camryn Revitte | $99 |
| 1802344 | Tanner Chik | $99 |
| 1594358 | NULL | $99 |
+---------+-----------------+---------+
5 rows in set (0.00 sec)
將upcase更改爲locase。 – 2015-01-21 05:57:44
@AvinashRaj然後呢? – glglgl 2015-01-21 07:03:39
對所有的downvoters:有什麼意義?你不明白這個問題嗎? – glglgl 2015-01-21 07:04:11