All pastes #832495 Raw Edit

Miscellany

public sql v1 · immutable
#832495 ·published 2007-12-26 07:14 UTC
rendered paste body
SELECT Get_Txn_Search_Customer_Name(x.accountno) customer_name ,  x.* FROM (  SELECT y.* FROM (  SELECT t.TXNREFNO,t.TxnId,t.TXNDATE,t.TXNAMOUNT, a.ACCOUNTNUMBER,a.ACCOUNTTYPE,a.ACCOUNTNO FROM account a,amltransaction t WHERE  t.ACCOUNTNO = a.ACCOUNTNO  and t.TxnId IN  (  SELECT t.TxnId FROM  (  SELECT ca.CustomerId account_cust_id,a.ACCOUNTTYPE, concat( ifnull(c.FirstName,''),' ',ifnull(c.MiddleName,''),' ', ifnull(c.LastName,'')) customer_name, a.ACCOUNTNO, a.ACCOUNTNUMBER, c.CustomerNo  FROM account a,customer c,customer_account ca   WHERE ca.CustomerId = c.CustomerId  and ca.ACCOUNTNO = a.ACCOUNTNO) ac, amltransaction t WHERE t.ACCOUNTNO = ac.ACCOUNTNO and   t.branchcode = '003' and  cast(   t.TXNAMOUNT as DECIMAL(38,4)) >0.0  and    upper(t.CURRENCY) LIKE 'PHP%'   and t.TXNDATE  >=   STR_TO_DATE('03-JAN-2005','%d-%M-%Y')  and  t.TXNDATE  <=   STR_TO_DATE('18-DEC-2007','%d-%M-%Y')  )  ) y  ) x LIMIT 0,10