Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.75 KB | None | 0 0
  1. CREATE OR REPLACE ALGORITHM = MERGE VIEW dwh_incomes_attributes_quantity_sale AS
  2.  
  3. SELECT
  4.     opn.last_date_update AS date_added
  5.     , CAST(opn.id AS INT) AS operation_id
  6.     , 4 AS operation_type_id
  7.     , cast(opn.incomes_items_id as int) as incomes_items_id
  8.     , CAST(DATE_FORMAT(opn.date_added,'%Y%m%d') AS INT) AS calendar_date_id
  9.     , CAST(opn.products_attributes_id AS INT) AS products_attributes_id
  10.     , CAST(opn.incomes_attributes_id AS INT) AS incomes_attributes_id
  11.     , -1 AS incomes_attributes_quantity
  12.     , 0 AS incomes_attributes_quantity_stock_zones
  13.     , opn.net_sales_qty AS incomes_attributes_quantity_net_sales
  14.     , opn.delivers_qty AS incomes_attributes_quantity_delivers_qty
  15.     , opn.order_last_date_update
  16. FROM dwh_orders_products_incomes AS opn
  17. -- WHERE 2=3
  18. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement