title: PreparedStatement: Can I supply the column name as parameter?
body: <p>Let's say I have a table with 3 columns: C1, C2, C3</p>
  
  <p>I make a search based on the C1 column.
  Could I make something similar like this (<strong><em>this is not working</em></strong> - because this is <strong>not the way prepareStatement it's used</strong>:) )</p>
  
  <pre><code>String c;// the name of the column
  
  ...    
  String sql = "select * from table where ?  = ?";
                  pre = con.prepareStatement(sql);
                  pre.setString(1, c);
                  pre.setString(1, i);
                  rs = pre.executeQuery();
  </code></pre>
  
  <p>The main idea, I don't want to have 3 ifs for every column. An elegant solution?</p>