VbzCart/queries/qryStock Titles most recent

Details

 * Requires:, ,
 * Used by: This defines what the "latest stock" web page shows; as given here, it displays the 100 titles most recently added to stock.

SQL
CREATE OR REPLACE VIEW qryStock_Titles_most_recent AS SELECT i.ID_Title, s.QtyForSale AS QtyAdded, MAX(s.WhenAdded) AS WhenAdded, st.QtyForSale AS QtyAvail FROM (v_stk_lines_remaining AS s LEFT JOIN cat_items AS i ON s.ID_Item=i.ID) LEFT JOIN v_stk_titles_remaining AS st ON i.ID_Title=st.ID_Title GROUP BY i.ID_Title HAVING QtyAdded ORDER BY WhenAdded DESC LIMIT 100;