From a9516ef763e4ef55ddc8c0d5418f2be6a5e20fc6 Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Wed, 25 Jul 2012 23:51:24 +0200 Subject: [PATCH 1/1] Oprava statistiky --- assistants/stats/reserve.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assistants/stats/reserve.inc.php b/assistants/stats/reserve.inc.php index d8e92db..f161fa4 100644 --- a/assistants/stats/reserve.inc.php +++ b/assistants/stats/reserve.inc.php @@ -1,10 +1,10 @@ 'SELECT model_id,model_name,barcode_name,model_reserve,model_reserve as item_quantity_to_buy'. - ' FROM model LEFT JOIN barcode USING(model_id)'. + => 'SELECT model_id,model_name,model_reserve,model_reserve as item_quantity_to_buy'. + ' FROM model'. ' WHERE model_reserve>0 AND NOT EXISTS'. - ' (SELECT item_id FROM item WHERE barcode.barcode_id=item.barcode_id AND status_id=1 AND item_quantity>0 AND item_valid_till=0)', + ' (SELECT item_id FROM item LEFT JOIN barcode USING(barcode_id) WHERE barcode.model_id=model.model_id AND status_id=1 AND item_quantity>0 AND item_valid_till=0)', "Nakoupit: Dochází (WishList)" => 'SELECT model_id,model_name,barcode_name,model_reserve,'. ' COUNT(item_id),SUM(item_quantity),model_reserve-SUM(item_quantity) as item_quantity_to_buy'. -- 2.30.2