SELECT o.orderDate, od.quantityOrdered, p.productName, od.productCode, p.productName, p.quantityInStock, p.warehouseCode FROM orders o INNER JOIN orderdetails od ON o.orderNumber = od.orderNumber INNER JOIN products p ON p.productcode = od.productcode WHERE o.orderDate IS NULL OR o.orderDate < DATE_SUB(NOW(), INTERVAL 300 DAY) ; /frm above we get products that have not been sold for a specific period of time/