Skip to content

Instantly share code, notes, and snippets.

@asvechkar
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save asvechkar/eb0ca280e0cad5501c0a to your computer and use it in GitHub Desktop.

Select an option

Save asvechkar/eb0ca280e0cad5501c0a to your computer and use it in GitHub Desktop.
last transactions
Select
acqt.transaction_id As transactnum
, acqt.fld_007 As transactdate
, acqt.fld_004 / 100 As amount
, acqt.fld_042 As merchant_id
, acqt.fld_002 As card_num
, acqt.reader_sn As reader_num
, acqt.mti As transtype
, acqt.card_type As brand
, COALESCE(uc.user_id, ue.client_id, 1010379) As client_id
From acq_trans As acqt
LEFT Join users_clients As uc on uc.user_id = acqt.user_id
Left Join users_employes As ue on ue.user_id = acqt.user_id
Left Join acq_batches as ab on ab.batch_id = acqt.batch_id
Where acqt.fld_007 BETWEEN DATE_SUB(NOW(),INTERVAL 1 DAY) AND NOW()
and ab.batch_type = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment