zotov-vs

Untitled

Oct 28th, 2020
687
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE OR REPLACE VIEW kupivip_for_nav_log_noncash_view AS
  2.  
  3. SELECT l.id
  4. , l.transaction_id
  5. , l.customers_id
  6. , l.orders_id
  7. , IFNULL(l.payment_system_id, 0) AS payment_system_id
  8. , IFNULL(l.payment_system, 'to_orders')  AS payment_system
  9. , l.date_added
  10. , IF(l.payment_system IS NULL, -1, 1) * l.amount AS 'sum'
  11. FROM log_noncash AS l
  12. WHERE l.date_added >= '2020-10-01'
  13. AND l.contractors_id = 265;
RAW Paste Data