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 a.Id_Article item_id FROM vn2008.Articles a
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
WHERE #filter;
CALL bionic_calc ();
SELECT a.Id_Article item_id, a.description, b.available, b.price,
p.name producer, a.Foto, a.Article, a.Categoria, a.Medida,
a.Tallos, c.str color, o.str origin
FROM tmp.bionic_item b
JOIN vn2008.Articles a ON a.Id_Article = b.item_id
LEFT JOIN vn2008.producer p ON p.producer_id = a.producer_id
LEFT JOIN vn_locale.color_view c ON c.color_id = a.Color
LEFT JOIN vn_locale.origin_view o ON o.origin_id = a.id_origen
WHERE b.available > 0
ORDER BY a.Article, a.Medida
LIMIT 400;
CALL bionic_from_item (#item);
SELECT p.warehouse_id, w.name warehouse, 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
JOIN vn2008.warehouse w ON w.id = p.warehouse_id
ORDER BY warehouse_id, grouping;
SELECT o.id, o.date_send, ag.description agency, v.code method
FROM basket o
JOIN vn2008.Agencias ag ON ag.Id_Agencia = o.agency_id
JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id
Catalog
IndicativePhotos
from
SELECT r.id, l.str name, r.color
FROM vn2008.reinos r
LEFT JOIN vn_locale.realm_view l ON l.realm_id = r.id
WHERE r.display != FALSE
ORDER BY name
CALL item_available ();
SELECT DISTINCT t.tipo_id, l.str name
FROM vn2008.Tipos t
JOIN vn2008.Articles a ON a.tipo_id = t.tipo_id
LEFT JOIN vn_locale.family_view l ON l.family_id = t.tipo_id
JOIN tmp.item_available i ON i.item_id = a.Id_Article
WHERE #filter
ORDER BY name
CALL item_available ();
SELECT DISTINCT c.Id_Tinta, l.str name
FROM vn2008.Tintas c
JOIN vn2008.Articles a ON a.Color = c.Id_Tinta
LEFT JOIN vn_locale.color_view l ON l.color_id = c.Id_Tinta
JOIN tmp.item_available i ON i.item_id = a.Id_Article
WHERE #filter
ORDER BY name
CALL item_available ();
SELECT DISTINCT p.producer_id, p.name
FROM vn2008.producer p
JOIN vn2008.Articles a ON a.producer_id = p.producer_id
JOIN tmp.item_available i ON i.item_id = a.Id_Article
WHERE #filter
ORDER BY name
CALL item_available ();
SELECT DISTINCT o.id, l.str name, o.Abreviatura
FROM vn2008.Origen o
JOIN vn2008.Articles a ON a.id_origen = o.id
LEFT JOIN vn_locale.origin_view l ON l.origin_id = o.id
JOIN tmp.item_available i ON i.item_id = a.Id_Article
WHERE #filter
ORDER BY name
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