Answers.Body: <p>In <code>civicrm.settings.php</code>, you can enable:</p>
  
  <pre><code>define('CIVICRM_DEBUG_LOG_QUERY', 1);
  </code></pre>
  
  <p>Then run the "Advanced Search" and look at the output in <code>files/civicrm/ConfigAndLog/CiviCRM*log*</code>. This will output for several queries; to avoid accumulation of junk data, you should probably disable the <code>CIVICRM_DEBUG_LOG_QUERY</code> after running the query.</p>
  
  <p>There's some more discussion of this and other debugging techniques at <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers">http://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-07T16:08:50.943Z
Answers.Text: Thank you for the information. I appreciate the assistance.
Answers.UserDisplayName: pmatt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-07T00:51:35.813Z
Answers.LastActivityDate: 2015-07-07T00:51:35.813Z
Answers.UserDisplayName: Tim Otten
Body: <p>When I perform an advanced search I would like to see the query that is created based on the criteria I have chosen in the Advanced Search. Is there a way to see the query that is created?   </p>
  
Tags: <search><search-results>
Title: How can I tell what the query that is executing when I do an Advanced Search looks like?
ThreadText: # How can I tell what the query that is executing when I do an Advanced Search looks like?
  
  (Asked by: username_0 on 2015-07-06)
  
  When I perform an advanced search I would like to see the query that is created based on the criteria I have chosen in the Advanced Search. Is there a way to see the query that is created?
  
  **Tags:** search, search-results
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-07. Score: 6 | Accepted answer
  
  In civicrm.settings.php, you can enable:
  define('CIVICRM_DEBUG_LOG_QUERY', 1);
  
  Then run the "Advanced Search" and look at the output in files/civicrm/ConfigAndLog/CiviCRM*log*. This will output for several queries; to avoid accumulation of junk data, you should probably disable the CIVICRM_DEBUG_LOG_QUERY after running the query.
  There's some more discussion of this and other debugging techniques at http://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers
  
  > **Comments:**
  > **username_0**: Thank you for the information. I appreciate the assistance.  
  
  ---
  
  