DECLARE @StartDate AS VARCHAR(20) DECLARE @EndDate AS VARCHAR(20)
SET @StartDate = 'Apr 1 2018'
SET @EndDate = 'Aug 30 2018'
SELECT B.OrganizationV6 AS CompanyName,
b.contact_nameV6,
c.PostalAddress1,
c.PostalAddress2,
c.PostalAddress3,
c.PostalState,
c.postalPostCode,
c.PostalCountry
FROM dbo.tblbookings AS B
LEFT OUTER JOIN tblCust C ON C.ID = B.CustID
Where
B.BookingProgressStatus = 3
AND B.Booking_type_v32 in (0,3)
AND (B.dDate BETWEEN CAST(@StartDate AS DATETIME) AND CAST(@EndDate AS DATETIME))
group by b.OrganizationV6, b.contact_nameV6,c.PostalAddress1, c.PostalAddress2, c.PostalAddress3, c.PostalState, c.postalPostCode, c.PostalCountry