Difference between revisions of "VbzCart/queries/qryCat Items Stock"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
|  (New page: ==About== * '''Requires''': {{vbzcart/table|cat_items}}, {{vbzcart/query|v_stk_items_remaining}} * '''Used by''': {{vbzcart/query|qryItTypsDepts grpItems}} * '''Notes''': This may turn out...) | m (→About:  space -> underscore) | ||
| Line 1: | Line 1: | ||
| ==About== | ==About== | ||
| − | * '''Requires''': {{vbzcart | + | * '''Requires''': {{vbzcart|table|cat_items}}, {{vbzcart/query|v_stk_items_remaining}} | 
| − | * '''Used by''': {{vbzcart/query| | + | * '''Used by''': {{vbzcart/query|qryItTypsDepts_grpItems}} | 
| * '''Notes''': This may turn out to be inefficient, since it retrieves a lot of data which may not be needed | * '''Notes''': This may turn out to be inefficient, since it retrieves a lot of data which may not be needed | ||
| * '''History''': | * '''History''': | ||
| ** '''2009-04-12''' Created to replace cat_items.qtyInStock field | ** '''2009-04-12''' Created to replace cat_items.qtyInStock field | ||
| + | |||
| ==SQL== | ==SQL== | ||
| <section begin=sql /><mysql>CREATE OR REPLACE VIEW qryCat_Items_Stock AS | <section begin=sql /><mysql>CREATE OR REPLACE VIEW qryCat_Items_Stock AS | ||
Revision as of 13:42, 7 May 2009
About
- Requires: cat_items,
- REDIRECT Template:l/vc/query
- Used by: qryItTypsDepts_grpItems
- Notes: This may turn out to be inefficient, since it retrieves a lot of data which may not be needed
- History:
- 2009-04-12 Created to replace cat_items.qtyInStock field
 
SQL
<mysql>CREATE OR REPLACE VIEW qryCat_Items_Stock AS SELECT
i.*, SUM(st.qtyForSale) AS qtyForSale, SUM(st.qtyForShip) AS qtyForShip
FROM (cat_items AS i LEFT JOIN v_stk_items_remaining AS st on i.ID=st.ID_Item) GROUP BY i.ID;</mysql>