Difference between revisions of "SH.PROFITS (view)"

From dbscript Online Help
Jump to: navigation, search
Line 2: Line 2:
  
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
|-
+
|- valign="top"
 
| '''View
 
| '''View
 
| SH.PROFITS
 
| SH.PROFITS
|-
 
 
|}
 
|}
 
  
 
=== Source ===
 
=== Source ===
Line 37: Line 35:
 
| '''Referenced Object
 
| '''Referenced Object
  
|-
+
|- valign="top"
 
| Select
 
| Select
 
| Table
 
| Table

Revision as of 07:16, 24 June 2010

wikibot

View SH.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

References

Dependency Type Object Type Referenced Object
Select Table SH.COSTS