从SQL查询生成美元金额输出

时间:2017-05-15 15:24:22

标签: c# mysql sql sql-server pattern-matching

我需要帮助产生一个美元金额,其中包含瓜尔胶责任,瓜尔胶总量和余额余额表。现在,它产生一个十进制风格的数字,很难为员工阅读。你在哪里添加SQL语言只能拉出$ amount?任何帮助,将不胜感激。 SQL查询是:

select top 10 b.date_of_service as DOS
             ,b.GUARANTOR_ID as Guarantor
             ,b.service_status_value as [Status]
             ,b.guarantor_liability as [Guar Liability]
             ,b.guarantor_total_payments as [Guar Total Payments]
             ,b.remaining_balance as [Rem Balance]
             ,b.CLAIM_NUMBER as [Claim #]
from SYSTEM.billing_tx_charge_detail b
where(b.GUARANTOR_ID = "100")
     or (b.GUARANTOR_ID = "110")
     or (b.GUARANTOR_ID = "111")
     or (b.GUARANTOR_ID = "112")
     or (b.GUARANTOR_ID = "113")
     or (b.GUARANTOR_ID = "114")
     or (b.GUARANTOR_ID = "115")
     or (b.GUARANTOR_ID = "119")
     and (b.FACILITY = ?FACILITY)
     and (b.PATID = ?PATID)
order by b.date_of_service desc;

1 个答案:

答案 0 :(得分:0)

您可以尝试使用FLOOR将结果向下舍入到最接近的整数。这样的事情。

select top 10 b.date_of_service as DOS
             ,b.GUARANTOR_ID as Guarantor
             ,b.service_status_value as [Status]
             ,FLOOR(b.guarantor_liability) as [Guar Liability]
             ,b.guarantor_total_payments as [Guar Total Payments]
             ,b.remaining_balance as [Rem Balance]
             ,b.CLAIM_NUMBER as [Claim #]
from SYSTEM.billing_tx_charge_detail b
where(b.GUARANTOR_ID = "100")
     or (b.GUARANTOR_ID = "110")
     or (b.GUARANTOR_ID = "111")
     or (b.GUARANTOR_ID = "112")
     or (b.GUARANTOR_ID = "113")
     or (b.GUARANTOR_ID = "114")
     or (b.GUARANTOR_ID = "115")
     or (b.GUARANTOR_ID = "119")
     and (b.FACILITY = ?FACILITY)
     and (b.PATID = ?PATID)
order by b.date_of_service desc;