Avatar of tim_carter
tim_carter

asked on 

Count Dates With SQL

Hi Guys

Im trying to build a calendar, i have made a table with the dates in a month, an would like to display bold text on a day where a user has a meeting. this works fine for me

$select = "
            SELECT
                  Count(*) as Total
            FROM
                  Booking
            WHERE
                  CustomerId = ".$_SESSION['CustomerId']."
                  AND DATEPART(Day,StartDate) = $i
                  AND DATEPART(Month,StartDate) = $Month
                  AND DATEPART(Year,StartDate) = $Year
                  AND UserId = $UserId
                  AND Deleted IS NULL
      ";

unless ofcourse the meeting expands over more than one day. Lets say tha $i is 2, and the user has a meeting from the 2nd to the 3rd. Then ofcourse i want the 3 day in the calender to be bold aswell so the user can se he has a meeting. How do i do that? Like the field StartDate which is a datetime, i have an EndDate which is a datetime? thanks

SQL

Avatar of undefined
Last Comment
tim_carter

8/22/2022 - Mon