Untitled

mail@pastecode.io avatar
unknown
sql
2 years ago
561 B
6
Indexable
Never
SELECT 
    j1.serialnumber,
    product,
    size,
    location,
    bin,
    previouslocation,
    previousbin,
    lastscandate,
    scandate
FROM
    (SELECT 
        serialnumber, lastscandate AS scandate
    FROM
        shard.inventoryitemupdate
    WHERE
        location = '7-444T-1a' AND qtyonhand = 1
            AND lastscandate >= '2022-12-09 00:00:00'
            AND lastscandate <= '2022-12-09 23:59:59'
    LIMIT 10000) j1
        JOIN
    inventoryitem j2 ON j2.serialnumber = j1.serialnumber
WHERE
    qtyonhand = 1 AND bin != ''
GROUP BY bin