Answers.Body: <p>The syntax for comparing a date should be:</p>
  
  <pre><code>-&gt;andWhere('dateCreated &gt; "2017-02-11"')
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-20T18:10:46.330Z
Answers.LastActivityDate: 2017-02-20T18:10:46.330Z
Answers.UserDisplayName: Brad Bell
Body: <p>What am I doing wrong in the 'andWhere' part of this query? I've tried a variety of different ways of doing it but nothing seems to work... It just seems to be ignored. Does anyone know the proper way I should be doing it?</p>
  
  <pre><code>foreach($entryIds as $entryId) {
      $data[] = craft()-&gt;db-&gt;createCommand()
      -&gt;select('*')
      -&gt;from('amforms_content')       
      -&gt;where(array(
              'elementId' =&gt; $entryId
      ))
      -&gt;andWhere('dateCreated &gt; 2017-02-11')
      -&gt;queryAll();
  }
  
  return array($data);
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-17T17:20:16.473Z
Comments.Text: Try: `->andWhere('dateCreated > "2017-02-11"')`
Comments.UserDisplayName: Brad Bell
Tags: <plugin-development><query>
Title: Can anyone tell me what's wrong with the 'andWhere' part of this query?
ThreadText: # Can anyone tell me what's wrong with the 'andWhere' part of this query?
  
  (Asked by: username_0 on 2017-02-17)
  
  What am I doing wrong in the 'andWhere' part of this query? I've tried a variety of different ways of doing it but nothing seems to work... It just seems to be ignored. Does anyone know the proper way I should be doing it?
  
  ```
  foreach($entryIds as $entryId) {
      $data[] = craft()->db->createCommand()
      ->select('*')
      ->from('amforms_content')       
      ->where(array(
              'elementId' => $entryId
      ))
      ->andWhere('dateCreated > 2017-02-11')
      ->queryAll();
  }
  
  return array($data);
  
  ```
  
  **Tags:** plugin-development, query
  
  > **Comments:**
  > **username_1**: Try: `->andWhere('dateCreated > "2017-02-11"')`  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-02-20. Score: 2 | Accepted answer
  
  The syntax for comparing a date should be:
  
  ```
  ->andWhere('dateCreated > "2017-02-11"')
  
  ```
  
  
  ---
  
  