I created a simple view page of content with an exposed date filter. The resulting query is:

SELECT node.created AS node_created, node.nid AS nid
{node} node
WHERE (( (node.status = '1') AND (node.type IN  ('press_release')) ))
ORDER BY node_created DESC

When I tried to create the same view as a block, it gave me another query:

SELECT node.created AS node_created, node.nid AS nid
{node} node
LEFT JOIN {field_data_field_date} field_data_field_date ON node.nid = field_data_field_date.entity_id AND (field_data_field_date.entity_type = 'node' AND field_data_field_date.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN  ('press_release')) AND (DATE_FORMAT(ADDTIME(field_data_field_date.field_date_value, SEC_TO_TIME(-14400)), '%Y-%m-%d') = '') ))
ORDER BY node_created DESC

The later query is not correct. The resulting view is empty by default and it doesn't even show the exposed date filter. What is happening here?

EDIT: Here is a screenshot of the page view edit screen: enter image description here

EDIT: Here is a screenshot for the date filters of the page and the block. Neither is required and the settings are the same: enter image description here

enter image description here

  • Clearly the first request you gave doesn't include a date filter... can you check and edit ? Thanks. – Gregory Kapustin May 9 '14 at 13:08
  • @GregoryKapustin - I the date filter is set. I have included a screenshot – user1015214 May 9 '14 at 13:53
  • Can you also give us the settings of the filter ? It seems that it's required, and so on. – Gregory Kapustin May 9 '14 at 15:03
  • Yeah, exposed filters don't get added to the query unless they have a value or they are required. That would likely explain the difference between the two. – mpdonadio May 9 '14 at 15:10
  • The settings are the same. I have added more screenshots. – user1015214 May 9 '14 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.