SELECT item_id, warehouse_id, SUM(amount) amount
FROM basket_item
GROUP BY warehouse_id
CREATE TEMPORARY TABLE tmp.bionic_calc
(INDEX (item_id))
ENGINE=MEMORY
SELECT Id_Article item_id FROM vn2008.Articles
WHERE #filter;
CALL bionic_calc ();
SELECT a.Id_Article item_id, t.available, t.price, p.producer,
a.Foto, a.Article, a.Categoria, a.Medida, a.Tallos, a.Color, o.Abreviatura
FROM tmp.bionic_item t
JOIN vn2008.Articles a ON a.Id_Article = t.item_id
LEFT JOIN vn2008.Articles_producer p ON p.Id_Article = a.Id_Article
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
WHERE t.available > 0
ORDER BY a.Article, a.Medida
LIMIT 400;
CALL bionic_from_item (#item);
SELECT p.warehouse_id, p.grouping, p.price, p.rate, l.available
FROM tmp.bionic_lot l
JOIN tmp.bionic_price p
ON p.warehouse_id = l.warehouse_id
ORDER BY warehouse_id, grouping;
Catalog
IndicativePhotos
from
CALL item_available ();
SELECT DISTINCT r.id, r.reino
FROM vn2008.reinos r
JOIN vn2008.Tipos t ON t.reino_id = r.id
JOIN vn2008.Articles a ON a.tipo_id = t.tipo_id
JOIN tmp.item_available i ON i.item_id = a.Id_Article
WHERE /*#filter
AND*/ r.display
ORDER BY r.reino
CALL item_available ();
SELECT DISTINCT t.tipo_id, LEFT(t.Tipo, 18) type
FROM vn2008.Tipos t
JOIN vn2008.Articles a ON a.tipo_id = t.tipo_id
JOIN tmp.item_available i ON i.item_id = a.Id_Article
/*WHERE #filter*/
ORDER BY t.Tipo
CALL item_available ();
SELECT DISTINCT c.Id_Tinta, c.name
FROM vn2008.Tintas c
JOIN vn2008.Articles a ON a.Color = c.Id_Tinta
JOIN tmp.item_available i ON i.item_id = a.Id_Article
/*WHERE #filter*/
ORDER BY c.name
CALL item_available ();
SELECT DISTINCT o.id, o.Origen, o.Abreviatura
FROM vn2008.Origen o
JOIN vn2008.Articles a ON a.id_origen = o.id
JOIN tmp.item_available i ON i.item_id = a.Id_Article
/*WHERE #filter*/
ORDER BY o.Origen
CALL item_available ();
SELECT DISTINCT a.Categoria, a.Categoria category
FROM vn2008.Articles a
JOIN tmp.item_available i ON i.item_id = a.Id_Article
/*WHERE #filter*/
ORDER BY a.Categoria