Results 1 to 5 of 5
  1. #1
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    97

    Group by week

    Ok I have 2 questions.

    First I need a query that will serve as a "log" of the number of order we had on each week of each years

    lets say
    Date: NumberofOrder:
    week1-Year2000 11
    week2-year2000 22


    week1-year2001 07

    my second query needs me to know how many order we had THIS WEEK, THIS YEAR

    I tried many things but i'm lost... I used the datepart for the week but when I do this it gives me 1230 orders cause it adds all the order from this week from the previous years...

  2. #2
    RedWolf3x is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Posts
    31
    Please post the code you used to return the week values for all years, it seems all you may need to to append that to include a this year statement.

  3. #3
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    97
    Code:
     
    SELECT Count([Tbl_Soumission.Job_envoyee]) AS Services, DatePart("ww",[Tbl_Soumission.Job_envoyee]) AS wk
    FROM Tbl_Soumission
    WHERE (((Tbl_Soumission.No_Job) Like "*" & "S" & "*" Or (Tbl_Soumission.No_Job) Like "*" & "E" & "*"))
    GROUP BY DatePart("ww",[Tbl_Soumission.Job_envoyee]);
    this is my access sql

  4. #4
    RedWolf3x is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Posts
    31
    I may be incorrect here, but I think your issue could be solved of you add to your where statement

    Add "And Year(Tbl_Soumission.Job_envoyee)-Year(Date())"

    I'm fairly certain that will work.

    -Red

  5. #5
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    97
    I don't think this is what I'm looking for!

    Your statement works flawlessly BUT!
    what I want is not the number of orders by week only

    but the number of lets say the orders i got on week 45 of years 2010 !

    and If I had the code you just gave me, it only gives me the weekly order of this years !

    I'm looking for something like
    Date Orders
    45-2011 26

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

Similar Threads

  1. How to group by week
    By accessmatt in forum Reports
    Replies: 21
    Last Post: 09-28-2011, 09:40 AM
  2. Data group by week
    By hoachen in forum Access
    Replies: 2
    Last Post: 09-09-2011, 08:37 AM
  3. Replies: 5
    Last Post: 11-29-2010, 08:16 AM
  4. Group by Week in a Crosstab Query
    By NMJones in forum Access
    Replies: 1
    Last Post: 06-24-2010, 04:09 PM
  5. columns for group detail but not group header?
    By Coolpapabell in forum Reports
    Replies: 0
    Last Post: 08-21-2009, 08:53 AM

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