Untitled

mail@pastecode.io avatar
unknown
mysql
a year ago
1.7 kB
4
Indexable
Never
SELECT 
    i.product,
    p.code2 AS stylenum,
    COUNT(i.serialnumber) units,
    i.size,
    FORMAT(SUM(ROUND(p.wholesalecost)), 'c') sumcost,
    FORMAT(ROUND(p.wholesalecost), 'c') cost,
    FORMAT(ROUND(p.retailprice), 'c') price
FROM
    (SELECT 
        serialnumber, product, size
    FROM
        inventoryitem
    WHERE
        product IN ('SLAU-WY1160' , 'SLAU-WY1245', 'SLAU-WY1267', 'SLAU-WY1291', 'SLAU-WY1364', 'SLAU-WY1366', 'SLAU-WY1411', 'SLAU-WY1483', 'SLAU-WY1520', 'SLAU-WY1625', 'SLAU-WY1693', 'SLAU-WY1697', 'SLAU-WY1768', 'SLAU-WY1796', 'SLAU-WY1828', 'SLAU-WY1844', 'SLAU-WY1850', 'SLAU-WY1862', 'SLAU-WY1893', 'SLAU-WY1914', 'SLAU-WY1917', 'SLAU-WY1925', 'SLAU-WY1944', 'SLAU-WY1930', 'SLAU-WY1946', 'SLAU-WY1950', 'SLAU-WY1977', 'SLAU-WY2025', 'SLAU-WY2031', 'SLAU-WY2034', 'SLAU-WY2038', 'SLAU-WY2040', 'SLAU-WY2042', 'SLAU-WY2050', 'SLAU-WY2052', 'SLAU-WY2068', 'SLAU-WY2074', 'SLAU-WY2076', 'SLAU-WY2090', 'SLAU-WY2093', 'SLAU-WY2095', 'SLAU-WY2104', 'SLAU-WY2105', 'SLAU-WY2110', 'SLAU-WY2111', 'SLAU-WY2117', 'SLAU-WY2126', 'SLAU-WY2127', 'SLAU-WY2132', 'SLAU-WY2134', 'SLAU-WY2144', 'SLAU-WY2151', 'SLAU-WY2163', 'SLAU-WY2170', 'SLAU-WY2184', 'SLAU-WY2188', 'SLAU-WY2193', 'SLAU-WY2195', 'SLAU-WY2202', 'SLAU-WY2205', 'SLAU-WY2211', 'SLAU-WY997', 'SLAU-WY332', 'SLAU-WY2149', 'SLAU-WY2141', 'SLAU-WY2106', 'SLAU-WY2099', 'SLAU-WY2049', 'SLAU-WY2022', 'SLAU-WY1606', 'SLAU-WY1598', 'SLAU-WY1564', 'SLAU-WY1446', 'SLAU-WY1244', 'SLAU-WY1107')
            AND location = 'Inventory Pending'
            AND qtyonhand = 0
            AND notes LIKE '%by viridiana leon, Reason:Saint Laurent Liquidation%'
            AND bin = 'bSL') i
        JOIN
    product p ON i.product = p.code
GROUP BY i.product