title: Cassandra CQL: How to do WHERE-like queries on dynamic columns?
body: <p>Consider the following simple table in Cassandra, with some values inserted via CQL3:</p>
  
  <pre><code>CREATE TABLE sometable (  
    id varchar,  
    name varchar,  
    value varchar,  
    PRIMARY KEY (id, name));
  
  INSERT INTO sometable (id, name, value) VALUES ('Mary', 'Favorite Color', 'Red');
  INSERT INTO sometable (id, name, value) VALUES ('George', 'Favorite Color', 'Green');
  INSERT INTO sometable (id, name, value) VALUES ('Bob', 'Favorite Color', 'Red');
  INSERT INTO sometable (id, name, value) VALUES ('Mary', 'Phone', '555-1234');
  INSERT INTO sometable (id, name, value) VALUES ('George', 'Phone', '555-1212');
  INSERT INTO sometable (id, name, value) VALUES ('Bob', 'Email', 'bob@bob.com');
  </code></pre>
  
  <p>Let's say we want to get the phone numbers of everyone whose favorite color is red. For example, something like:</p>
  
  <pre><code>SELECT 'Phone' FROM sometable WHERE 'Favorite Color' = 'Red';
  </code></pre>
  
  <p>The only way I can think of actually doing this would be to select the names of all columns of interest, and then do the filtering client-side:</p>
  
  <pre><code>SELECT name, value from sometable WHERE name IN ('Favorite Color', 'Phone') allow filtering;
  </code></pre>
  
  <p>Is there a way to filter on dynamic column values in CQL, or in any other Cassandra API?</p>