Advertisement
Guest User

sql report atsdili

a guest
Apr 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.15 KB | None | 0 0
  1.  SELECT 0          Batch,
  2.        a.rm_1     RemittanceNo,
  3.        ''         DebtorName,
  4.        ''         DebtorAccount,
  5.        ''         DebtorBIC,
  6.        ''         CreditorName,
  7.        ''         CreditorAccount,
  8.        ''         RMTTR2,
  9.        ''         CreditorBIC,
  10.        a.rmchka_1 Amount,
  11.        NULL       RemittanceInformation,
  12.        a.status_code,
  13.        NULL       UploadTime,
  14.        NULL       UploadBy
  15. FROM   ats_payment a
  16. WHERE  a.ats_format = 3
  17.        AND a.rm_1 LIKE '%'
  18.        AND a.status_code LIKE '%'
  19. UNION
  20. SELECT 0          Batch,
  21.        a.rm_1     RemittanceNo,
  22.        ''         DebtorName,
  23.        ''         DebtorAccount,
  24.        ''         DebtorBIC,
  25.        ''         CreditorName,
  26.        ''         CreditorAccount,
  27.        ''         RMTTR2,
  28.        ''         CreditorBIC,
  29.        a.rmchka_1 Amount,
  30.        NULL       RemittanceInformation,
  31.        a.status_code,
  32.        NULL       UploadTime,
  33.        NULL       UploadBy
  34. FROM   ats_payment_hist a
  35. WHERE  a.ats_format = 3
  36.        AND a.rm_1 LIKE '%'
  37.        AND a.status_code LIKE '%'
  38. UNION
  39. SELECT Isnull(b.batch, 0) batch,
  40.        b.remittanceno,
  41.        b.debtorname,
  42.        b.debtoraccount,
  43.        b.debtorbic,
  44.        b.creditorname,
  45.        b.creditoraccount,
  46.        b.rmttr2,
  47.        b.creditorbic,
  48.        b.amount,
  49.        b.remittanceinformation,
  50.        b.status_code,
  51.        b.uploadtime,
  52.        b.uploadby
  53. FROM   ats_payment a
  54.        INNER JOIN ats_bulk_detail b
  55.                ON a.rm_1 = b.msg_id
  56. WHERE  ats_format = 3
  57.        AND a.rm_1 LIKE '%'
  58.        AND a.status_code LIKE '%'
  59. UNION
  60. SELECT Isnull(b.batch, 0) batch,
  61.        b.remittanceno,
  62.        b.debtorname,
  63.        b.debtoraccount,
  64.        b.debtorbic,
  65.        b.creditorname,
  66.        b.creditoraccount,
  67.        b.rmttr2,
  68.        b.creditorbic,
  69.        b.amount,
  70.        b.remittanceinformation,
  71.        b.status_code,
  72.        b.uploadtime,
  73.        b.uploadby
  74. FROM   ats_payment_hist a
  75.        INNER JOIN ats_bulk_detail_hist b
  76.                ON a.rm_1 = b.remittanceno
  77. WHERE  ats_format = 3
  78.        AND a.rm_1 LIKE '%'
  79.        AND a.status_code LIKE '%'
  80. ORDER  BY remittanceno,
  81.           batch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement