• meichmann - Thursday, February 1, 2018 7:14 AM

    Hello Everyone,
         I hope someone can help me out with this.  I have an order table that stores order information.

    Order Number

    Order Date

    1

    01/01/18

    2

    01/04/18

    3

    01/09/18

    4

    01/17/18

    5

    01/18/18

    What I need is to get total counts per week so the result would look like this:

    Week of

    Count

    01/01/08

    2

    01/08/18

    1

    01/15/18

    2


    I also need this to be date driven so the user can put in a start and end date.

    Thanks for all your help!! 🙂

    Bad manners and ignorance are not a good way to go through a career in IT. SQL forums require that you post DDL, so the people that are giving you free consulting do not have to transcribe data from the pictures on their screens. Not only did you post pictures, but you even seem to know that standard ANSI/ISO Standard SQL only allows for dates to be formatted as "yyyy-mm-dd" strings.

    This is based on the ISO 8601 temporal display standards. Anybody in IT should know what because the second most popular standard after the metric system. Would you trust an engineer who doesn't know the metric system and uses cubits?

    This standard includes the ISO weekly date format,.: "yyyyW[1-5][0-9]-[1-7]" the first four digits are the year, the next token is a W, followed by the number of the week within the year (1 to 52 or 53) another piece of punctuation the –, and the day of the week (Monday =1). This calendar is very popular in the Nordic countries, and you can find conversion tables on the Internet. Would you can download into your calendar table. If you don't know what a calendar table is, please Google it; it's a fundamental programming idiom in SQL.

    Please post DDL and follow ANSI/ISO standards when asking for help.