Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE ALGORITHM = MERGE VIEW dwh_incomes_attributes_quantity_sale AS
- SELECT
- opn.last_date_update AS date_added
- , CAST(opn.id AS INT) AS operation_id
- , 4 AS operation_type_id
- , cast(opn.incomes_items_id as int) as incomes_items_id
- , CAST(DATE_FORMAT(opn.date_added,'%Y%m%d') AS INT) AS calendar_date_id
- , CAST(opn.products_attributes_id AS INT) AS products_attributes_id
- , CAST(opn.incomes_attributes_id AS INT) AS incomes_attributes_id
- , -1 AS incomes_attributes_quantity
- , 0 AS incomes_attributes_quantity_stock_zones
- , opn.net_sales_qty AS incomes_attributes_quantity_net_sales
- , opn.delivers_qty AS incomes_attributes_quantity_delivers_qty
- , opn.order_last_date_update
- FROM dwh_orders_products_incomes AS opn
- -- WHERE 2=3
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement