微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为配置数据库中的case语句列创建字段过滤器时出现问题

如何解决为配置数据库中的case语句列创建字段过滤器时出现问题

我在使用Metabase中的case语句为列创建字段过滤器时遇到问题。

我的sql代码-

SELECT fk_sender_id,(SELECT company_name FROM Stardb.st_users AS u WHERE 
    u.client_id=plogs.transaction_log.fk_sender_id) AS Sender_name,fk_reciever_id,(SELECT company_name FROM Stardb.st_users AS u WHERE 
    u.client_id=plogs.transaction_log.abc_ref_no) AS Buyer_name,(SELECT company_name FROM Stardb.st_users AS u WHERE u.client_id=plogs.transaction_log.fk_reciever_id) AS Reciver_name,amount,req_type,abc_ref_no,(CASE
WHEN req_type=1 THEN “Inward Remittance”
WHEN req_type=5 THEN “Creation Margin Paid For Auction”
WHEN req_type=7 THEN “Payment Received from Buyer”
WHEN req_type=8 THEN “Funds Transferred To Wallet”
WHEN req_type=9 THEN “Outward Remittance”
WHEN req_type=10 THEN “EMD refunded after Auction completion”
WHEN req_type=11 THEN “EMD refunded (Auction time lapsed)”
WHEN req_type=12 THEN “EMD Paid For Auction”
WHEN req_type=13 THEN “Payment Released to Seller”
WHEN req_type=14 THEN “Balance Amount refunded to Buyer after Trade Complete”
WHEN req_type=15 THEN “ABC Commission taken from Buyer”
WHEN req_type=16 THEN “ABC Commission taken from Seller”
WHEN req_type=19 THEN “EMD refunded. Auction Rejected after Completion”
WHEN req_type=20 THEN “EMD refunded (Buyer & Seller).Trade Completed”
WHEN req_type=21 THEN “Creation Margin refunded.Auction Rejected”
WHEN req_type=22 THEN “SD paid”
WHEN req_type=23 THEN “Balance paid”
WHEN req_type=24 THEN “Extra payment refund(less quantity or deduction etc)”
WHEN req_type=25 THEN “Money Taken from Defaulters”
WHEN req_type=26 THEN “Money Taken from Defaulters”
WHEN req_type=27 THEN “TCS Payment from buyer”
WHEN req_type=28 THEN “TCS refund to buyer”
WHEN req_type=29 THEN “Payment made to Assayer”
WHEN req_type=33 THEN “Buyer SD refund”
WHEN req_type=35 THEN “Payment Setoff (Positive)”
WHEN req_type=36 THEN “Payment Setoff (Negative)”
WHEN req_type=37 THEN “Payment for Lab Request taken by client”
WHEN req_type=38 THEN “Payment sent to Lab”
WHEN req_type=40 THEN “Stock Management Charges”
WHEN req_type=41 THEN “Labour Charges”
WHEN req_type=42 THEN “Assaying Charges”
WHEN req_type=43 THEN “Baggage Charges”
WHEN req_type=44 THEN “Weighment Charges”
WHEN req_type=45 THEN “Sutli Charges”
WHEN req_type=46 THEN “SD paid by Seller”
WHEN req_type=47 THEN “Seller SD refunded”
WHEN req_type=48 THEN “Seller SD Forfeit”
END) AS Req_type_status,fk_order_id,created_date_time,bank_utr
FROM plogs.transaction_log
WHERE fk_order_id !=‘0’ AND plogs.transaction_log.isAbc= 1 AND    
plogs.transaction_log.fk_sender_id!=‘0’ and plogs.transaction_log.pay_status!=0

我想为Req_type_status添加一个字段过滤器,其下拉列表中的值为“ Seller SD Forfeit”(卖方SD没收),“ SD退还”等...而不是数字。

P.S。在原始表中,“ Req_type_status”列本身具有数字。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。