I am trying to select data from a table, using two date fields (startdate and enddate). With both date fields in the where clause no results are returned, with the startdate field taken out results are returned, what is going on? Can anyone help with this dilemna
My code is:
SELECT WPP.USERID,
WPI.EMAIL,
WPI.FIRSTNAME,
WPI.LASTNAME,
WPI.INSTITUTION
FROM WEBPROGRAMPARTICIPANTS WPP
JOIN WEBPERSONALINFO WPI ON WPP.USERID = WPI.USERID
JOIN WEBPROGRAMS WP ON WPP.PROGRAMCODE = WP.PROGRAMCODE
WHERE CONFIRMED = 1
AND WP.PROGRAMTYPE IN ('1')
AND WP.PROGRAMSTARTDATE >= '2009-01-02'
AND WP.PROGRAMENDDATE < '2009-09-15'
GROUP BY WPP.USERID,
WPI.EMAIL,
WPI.FIRSTNAME,
WPI.LASTNAME,
WPI.INSTITUTION
HAVING COUNT(WPP.PROGRAMCODE) > 1
ORDER BY WPP.USERID,
WPI.EMAIL
EDIT:
here is a result set to look at
USERID PROGRAMSTARTDATE PROGRAMENDDATE
------ ----------------------- -----------------------
26167 2009-03-09 00:00:00.000 2009-06-12 00:00:00.000
26362 2009-03-09 00:00:00.000 2009-06-12 00:00:00.000
26411 2009-03-09 00:00:00.000 2009-06-12 00:00:00.000
26491 2009-03-09 00:00:00.000 2009-06-12 00:00:00.000