Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    1

    Top Date per Date in another table

    Hi All



    This has really stumped me!

    I have two tables, one a Sales Table which holds store number, sales date, sales amount. And also a status table which holds store no, status date, and status name.

    I would like a query which gives a top status date per sales date.

    I have tried the following query, but it just drops sales dates.

    SELECT Sales.StoreID, Sales.Date, Max(Status.StatusDate) AS MaxOfStatusDate, Sum(Sales.Amount) AS SumOfAmount
    FROM Sales, Status
    GROUP BY Sales.StoreID, Sales.Date
    HAVING (((Max(Status.StatusDate))<=[Sales].[Date]));

    Can someone please help me???


    Many Thanks


    Dan

  2. #2
    Join Date
    May 2008
    Location
    North Charleston, SC
    Posts
    20
    the SQL looks correct; i have run a similar one on another database and it works as expected, e.g.
    1, '2008-1-1', '2008-1-1 19:38.00.00'
    4, '2008-1-1', '2008-1-1 13:07.00.00'

    What do you mean by "drops sales dates"?

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

Similar Threads

  1. Help with Day/Date
    By awdl22125 in forum Queries
    Replies: 1
    Last Post: 02-01-2008, 10:37 AM
  2. Between date
    By hondasteed01 in forum Queries
    Replies: 2
    Last Post: 11-14-2006, 06:54 AM
  3. Date or NA
    By extremme in forum Access
    Replies: 1
    Last Post: 07-26-2006, 06:38 AM
  4. Access Date/Time....I need a "generic" date.
    By beastmaster in forum Access
    Replies: 2
    Last Post: 12-29-2005, 12:55 PM
  5. Replies: 1
    Last Post: 12-09-2005, 10:29 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