Untitled

mail@pastecode.io avatar
unknown
mysql
2 years ago
392 B
2
Indexable
Never
SELECT 
    SUBSTRING_INDEX(SUBSTRING(location, 3, 11), '-', 1) bay,
    COUNT(DISTINCT bin) bins
FROM
    inventoryitem
WHERE
    location LIKE '7-LA%'
        AND qtyonhand = 1
GROUP BY bay
HAVING bins < 36;

SELECT 
    SUBSTRING(location, 1, 10) row,
    COUNT(DISTINCT serialnumber) serials
FROM
    inventoryitem
WHERE
    location LIKE '7-ULA32%'
        AND qtyonhand = 1
GROUP BY row