• SELECTCOUNT(*) AS User_Count

    FROM(

    SELECT[User_ID],

    MIN(Created_Date) AS First_Purchase_Date

    FROMdbo.Orders

    GROUP BY[User_ID]

    HAVINGMIN(Created_Date >= DATEDIFF(DAY, 1, GETDATE())

    AND MIN(Created_Date < DATEDIFF(DAY, 0, GETDATE())

    ) AS d


    N 56°04'39.16"
    E 12°55'05.25"