declare @T table ( ID int, From_Date date, To_Date date )

0

Please login or register to vote for this query.

(click on this box to dismiss)

CiviCRM Meta

Q&A about the site for administrators and users of the CiviCRM Constituent Relationship Management software

-- Enter Query Title
-- Enter Query Description

declare @T table
(
  ID int,
  From_Date date,
  To_Date date
)

insert into @T values
(1,  '2011-05-03', '2011-05-28'),
(2,  '2011-04-29', '2011-05-10'),
(3,  '2011-05-09', '2011-05-20'),
(4,  '2011-04-28', '2011-05-09'),
(5,  '2011-04-29', '2011-05-19'),
(6,  '2011-05-09', '2011-05-09'),
(7,  '2011-05-09', '2011-05-09'),
(8,  '2011-05-09', '2011-05-09'),
(9,  '2011-05-21', '2011-05-21'),
(10, '2011-06-06', '2011-06-06'),
(11, '2011-05-21', '2011-05-28'),
(12, '2011-05-14', '2011-05-28'),
(13, '2011-05-23', '2011-05-24'),
(14, '2011-05-27', '2011-05-27'),
(15, '2011-05-23', '2011-05-24')

declare @StartDate date = '2011-05-01'
declare @EndDate date = '2011-05-09'

select *
from @T
where From_Date Between @StartDate AND @EndDate AND
      To_Date Between @StartDate AND @EndDate

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results