I don't know why I can never remember how to do this, so I'm writing a blog post about it that I can refer back to later.
For example, say you have Drupal 7 module that uses the `db_select` function to query the database like so:
The client keeps asking what the SQL query that's used to build X. Here's how to get the query. (And yes I'm very lucky to have a client that knows SQL)
Setup your debugger with a breakpoint after the query is built and set this as a watch:
This will translate the Drupal query into the universal, sharable SQL query:
The screenshot below shows what this setup looks like in PhpStorm 9.