title: MySQL SELECT with unknown columnname
body: <p>I need a query like this: <code>SELECT id FROM database.table;</code>
  But I don't have the columnnames of the primary keys because the query must be universal for more tables. So I tried so make a query like this: </p>
  
  <pre><code>SELECT (SELECT k.COLUMN_NAME AS pk_old
  FROM information_schema.table_constraints t
  LEFT JOIN information_schema.key_column_usage k
  USING(constraint_name,table_schema,table_name)
  WHERE t.constraint_type='PRIMARY KEY'
      AND t.table_schema='database'
      AND t.table_name='table')as pk FROM database.table;
  </code></pre>
  
  <p>But instead of a list with the primary key values of that table like 1,2,3,4... I get a list with id,id,id,id....
  What can I do to get the values of the primary keys?</p>