I need to run a query in Joomla (3.5.1) that selects all the records whose date is not between its own date and 5 days later.
For example, suppose that a.DateSubmitted is equal to "2016-07-10 00:00:00". I want to select that record only if a.DateSubmitted is not between 2016-07-10 00:00:00 and 2016-07-15 00:00:00 . . p>
How do I do that?
I have the following, but it does not work. The browser returns only this: "Array ()", nothing more.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('a.SubmissionId, a.DateSubmitted, b.SubmissionId, b.FieldName, b.FieldValue')
->from($db->quoteName('#__rsform_submissions', 'a'))
->join('INNER', $db->quoteName('#__rsform_submission_values', 'b') . ' ON (' . $db->quoteName('a.SubmissionId') . ' = ' . $db->quoteName('b.SubmissionId') . ')')
->where($db->quoteName('a.DateSubmitted') . ' NOT BETWEEN \'' . $db->quoteName('a.DateSubmitted') . '\' AND \'' . date( $db->quoteName('a.DateSubmitted') , strtotime('+5 day')) . '\' ');