• Modify a SQL statement to sort by QTR

    Author
    Topic
    #458355

    I would like to modify the SQL below to sort the count by QTR and user. Not sure how to do this… Any thoughts? Thanks…

    SELECT Count(pndata_tbl.EIRID) AS CountOfEIRID, pndata_tbl.User, pndata_tbl.ClosedDate
    FROM pndata_tbl
    GROUP BY pndata_tbl.User, pndata_tbl.ClosedDate;

    Viewing 2 reply threads
    Author
    Replies
    • #1152322

      I assume that QTR means quarter. Do you want to group by quarter only or by year and quarter?

    • #1152323

      Yes it means quarter and I would like to sort by quarter and year. Thanks..

      • #1152324

        Try this:

        SELECT Count(pndata_tbl.EIRID) AS CountOfEIRID, pndata_tbl.User, Format([pndata_tbl].[ClosedDate],”yyyyQq”) AS QTR
        FROM pndata_tbl
        GROUP BY pndata_tbl.User, Format([pndata_tbl].[ClosedDate],”yyyyQq”);

    • #1152327

      Works great Hans. Thank you so much!!!

    Viewing 2 reply threads
    Reply To: Modify a SQL statement to sort by QTR

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: