| create or replace view v_transdtl as |
| SELECT t.transdate,t.transtime,t.billno,'' AS tradeno,'' AS authno,t.custname,c.bankcardno,d.rulename, |
| t1.deptname,t.termid,s.shopname,'' AS searchno,t.amount,'' AS serviceamt,t.transtype, |
| t.status,'T+1' AS cleartype,'普通' AS servicetype,0 AS revertamt,t.revbillno, |
| substr((t.revbillno), 0, 9) AS revtransdate FROM ((((tb_transdtl t |
| JOIN tb_card c ON (((t.cardno) = (c.cardno)))) |
| JOIN tb_discount_rule d ON ((t.ruleid = d.ruleid))) |
| JOIN ( SELECT c_1.custid, |
| p.deptname |
| FROM (tb_customer c_1 |
| JOIN tb_dept p ON (((c_1.deptcode) = (p.deptcode))))) t1 ON (((t.custid) = (t1.custid)))) |
| JOIN tb_shopsettlement s ON (((t.shopid) = (s.shopid)))); |