loan returns

 avatar
unknown
mysql
10 months ago
473 B
7
Indexable
SELECT 
    l.headerid, l.status, l.notes, i.*
FROM
    (SELECT 
        CONCAT('s', serialnumber) serial,
            product,
            size,
            bin,
            location,
            previouslocation,
            lastscandate
    FROM
        inventoryitem
    WHERE
        location = 'returns'
            AND previouslocation = 'loaned'
            AND qtyonhand = 1
    ORDER BY lastscandate ASC) i
        JOIN
    loanitem l ON l.serialnumber = i.serial
Editor is loading...
Leave a Comment