August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!
SELECT o.OrderDate, o.OrderRef, c.ClientCode, oi.Quantity, sno.Snos FROM tblOrders o INNER JOIN tblOrderItems oi ON o.OrderID = oi.OrderID INNER JOIN ( SELECT CatID, ClientCode FROM tblCatalogue WHERE TrackSerialNumbers = 1 ) c ON oi.CatID = c.CatID INNER JOIN ( SELECT a.OrderID, s.CatID, COUNT(s.SerialNumber) AS Snos FROM tblSerialNumbers s INNER JOIN tblAirwayBills a ON s.AirwayBillID = a.AirwayBillID GROUP BY OrderID, CatID ) sno ON o.OrderID = sno.OrderID AND sno.CatID = oi.CatID WHERE o.OrderID > 184876 AND (oi.Quantity <> sno.Snos) Order By o.OrderID Desc
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.