Add a subquery to SELECT'd columns in a dynamic query I have a query I want to run through Drupal 7's DB API as a dynamic query where a subquery needs to be a column of data. 

For example:

SELECT a, b, (
  SELECT x, y
    FROM table
    WHERE table.x = 'value') as c
FROM table_2
WHERE table_2.a = 'value_2'


How can I perform this through the Drupal 7's DB API?
You can use db_query()

$result = db_query(
  'SELECT a, b, (
    SELECT x, y
    FROM {table}
    WHERE table.x = :value1) as c
  FROM {table_2} AS table_2
  WHERE table_2.a = :value2',
  array(
    ':value1' =&gt; 'value',
    ':value2' =&gt; 'value_2',
  )
);