Untitled

mail@pastecode.io avatar
unknown
mysql
2 years ago
393 B
5
Indexable
Never
SELECT 
    t1.serialnumber,
    t1.bin,
    t1.location,
    MAX(t2.scandate) AS lastscandate
FROM
    alliance.allianceinventoryitem t1
        LEFT JOIN
    inventoryscanitem t2 ON t1.serialnumber = t2.serialnumber
WHERE
    qtyonhand = 1 AND t1.location NOT LIKE '7-%'
        AND t1.location NOT LIKE '7-T%'
GROUP BY t1.serialnumber , t1.bin , t1.location , t2.serialnumber
LIMIT 1000000;