View Single Post
  #4  
Old November 25th, 2009, 12:22 AM posted to microsoft.public.access.queries
Phil Smith
external usenet poster
 
Posts: 254
Default Sum means empty query?

Interesting. Before I read your response, I determined that the problem
focused on [Put Away Qty]. If I removed my "0" criteria, I got lots of
records, of course all zero.

However, after I fixed a bracketing issue, your solution seemed to work
perfectly. This is great for my project, but not much for my headache.
Can you explain what is/was going on?


Ken Snell wrote:
Try this:

SELECT item_types.name AS Type, brand.name AS Brand, item.old_sku,
item.long_desc, Sum(item_warehouse_link_history.change_qty) AS [QTY Put
Away], Sum(item_warehouse_link.onhand_qty) AS SumOfonhand_qty,
Max(FormatDateTime([item_warehouse_link_history]![date],2)) AS Expr1
FROM brand INNER JOIN (item_warehouse_link INNER JOIN (item_types INNER
JOIN (item_warehouse_link_history INNER JOIN item ON
item_warehouse_link_history.item_id = item.item_id) ON
item_types.type_id = item.item_type) ON item_warehouse_link.item_id =
item.item_id) ON brand.brand_id = item.brand_id
WHERE (((item_types.name)"Raw Apparel Misc" And
(item_types.name)"Raw Skate Misc") AND
((item_warehouse_link_history.change_qty)0) AND
((item_warehouse_link_history.warehouse_id)=1) AND
((item_warehouse_link_history.post_process)="Putaw ay Product") AND
((item_warehouse_link_history.date)=DateAdd("d",-14,Now())) AND
((item_warehouse_link.warehouse_id)=1))
GROUP BY item_types.name, brand.name, item.old_sku, item.long_desc
HAVING (((Sum(item_warehouse_link_history.change_qty))0) )
ORDER BY item_types.name, brand.name, item.old_sku, item.long_desc,
Max(FormatDateTime([item_warehouse_link_history]![date],2)) DESC;