Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20518

Re: Report SQL help

$
0
0

ah, this is a little more tricky being the last 30 days...

add something like:

AND

   (

   LTRIM(MONTH(FMC_AvailabilityByDays.datetime)) = (LTRIM(MONTH(getdate())) -1)

   AND

   DATEPART(dw, FMC_AvailabilityByDays.datetime) between 2 and 6  --- gives monday through friday

   AND

    (   --- gives btn 6a and 11p

        t.DateTime BETWEEN

            CAST(Convert(Char(10), FMC_AvailabilityByDays.datetime, 101) as smalldatetime) + ' 06:00'

            AND

            CAST(Convert(Char(10), FMC_AvailabilityByDays.datetime, 101) as smalldatetime) + ' 23:00'

    )

   )


Viewing all articles
Browse latest Browse all 20518

Trending Articles