Welcome Guest, you are in: Login

devio dbscript ScrewTurn Wiki

RSS RSS

Navigation





Search the wiki
»

PoweredBy

SH PROFITS (view)

RSS
Modified on 2011/08/27 12:11 by wikibot Categorized as Uncategorized

wikibot

ViewSH.PROFITS

Source

CREATE OR REPLACE VIEW SH.PROFITS AS 
SELECT
        s.channel_id,
        s.cust_id,
        s.prod_id,
        s.promo_id,
        s.time_id,
        c.unit_cost,
        c.unit_price,
        s.amount_sold,
        s.quantity_sold,
        c.unit_cost * s.quantity_sold TOTAL_COST
 FROM   costs c, sales s
 WHERE c.prod_id = s.prod_id
   AND c.time_id = s.time_id
   AND c.channel_id = s.channel_id
   AND c.promo_id = s.promo_id

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam.