Results 1 to 3 of 3
  1. #1
    lorainguy is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2012
    Posts
    2

    Need help with Crosstab Query for sales

    Hey all, first post.

    I have to pull a query to show all items in our inventory that have had no sales in the past 6 months.
    End result is to show any items with stock that have no sales in the past 6 months. Its easy to pull numbers on items that HAVE sold, but finding the ones that havent is my issue. Any help is appreciated (I hope this all makes sense)
    My Table structure is as follows:

    [Titles] linked to [Order_Details] by TitleID
    [Orders] linked to [Order_Details] by OrderID

    [Titles]
    TitleID
    Title
    Cost
    Stock


    [Orders]
    OrderID
    OrderDate


    ShipDate
    (various order/customer info)

    [Order_Details]
    OrderID
    TitleID
    ShippedQty
    (various product details by order...cost, etc)

  2. #2
    lorainguy is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2012
    Posts
    2
    All I am looking for is a result that shows:

    TitleID, Title, Shipped Qty
    Where Shipped Qty = 0
    Date rage < 6 mos

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    I would approach the problem in 2 steps and Not as a Crosstab.

    1- Find all Orders and Titles that have been Ordered in the last 6 months.Save query as OrdersLessThan6MonthsOld
    2- Find all Title which are not in OrdersLessThan6MonthsOld

    1 - OrdersLessThan6MonthsOld
    Code:
    SELECT Titles.Title, Titles.TitleId, OrderDetails.TitleId, Orders.Orderdate, Orders.OrderId
    FROM (OrderDetails INNER JOIN Titles ON OrderDetails.TitleId = Titles.TitleId)
     INNER JOIN Orders ON OrderDetails.Orderid = Orders.OrderId
    WHERE (((Orders.Orderdate)>=DateAdd("m",-6,Date())));
    2- TitlesNotOrderedinLast6Months
    Code:
    SELECT Titles.TitleId, Titles.Title, OrdersLessThan6MonthsOld.Title
    FROM Titles LEFT JOIN OrdersLessThan6MonthsOld ON Titles.Title = OrdersLessThan6MonthsOld.Title
    WHERE (((OrdersLessThan6MonthsOld.Title) Is Null));
    Sorry for any editing issues - I couldn't delete the little squares/rectangles.
    Last edited by orange; 04-05-2012 at 05:10 PM. Reason: attempted edit to remove boxes

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Crosstab query
    By Deutz in forum Queries
    Replies: 2
    Last Post: 08-23-2011, 06:43 PM
  2. Replies: 5
    Last Post: 06-30-2011, 02:24 AM
  3. Replies: 1
    Last Post: 07-30-2010, 10:28 AM
  4. need query to assign sales leads to reps??
    By RickM in forum Queries
    Replies: 0
    Last Post: 03-12-2009, 02:44 PM
  5. computing total sales per day using query
    By joms222 in forum Queries
    Replies: 0
    Last Post: 03-09-2009, 10:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums