title: inserting a string to a prepared statement without ' '
body: <p>I have the following sql statement:</p>
  
  <pre><code>Select i.imageID, theImage, translationRating
  From images i
  inner join translationchains  t
  on t.imageId = i.imageid
  where i.userID=(someUserID) And i.translated =0 
  and t.targetLang in (select targetLang from translationChains)
  </code></pre>
  
  <p>I want to make it a prepared statement to use in my java code:</p>
  
  <pre><code>Select i.imageID, theImage, translationRating
  From images i
  inner join translationchains  t
  on t.imageId = i.imageid
  where i.userID=? And i.translated =0 
  and t.targetLang in (select ? from translationChains)
  </code></pre>
  
  <p>the input for the first ? is a user Id (integer) and it's working fine.</p>
  
  <p>the second input is a string which containing a languageId - it's a string that either contain a number that represent a language, or the string "targetLang" which is the name of the column (=all langs)</p>
  
  <p>in my java code I did the following:</p>
  
  <pre><code>Image.setInt(1, userID);
  Image.setString(2, langID);
  Image.executeQuery()
  </code></pre>
  
  <p>my problem is when I'm sending the string "targetLang" as the second parameter
  the prepared statement is inserting it as 'targetLang' (with ' before and after'),  with numbers it's not a problem beacuse 3='3', but with strings it is giving me different results from what I need - I always get an empty result set because nothing is equal to 'targetLang'.
  I need to insert this string to the prepared statement without the '.
  is it possible or I need to use something differ from prepared statement?</p>
  
  <p>I know I can build a string that contain all this query but I'm looking for something more elegant
  tnx</p>
  
  <hr>
  
  <p><em>edit:</em></p>
  
  <p>This is the Create table translationChains:</p>
  
  <pre><code>Create Table if not exists TranslationChains (
    ImageID int (10) NOT NULL,  
    SourceLang int NOT NULL,
    TargetLang int NOT NULL,
    Translated tinyint default 0,
    Translation text,
    Translator varchar (30),
    CONSTRAINT translate_image PRIMARY KEY (ImageID,SourceLang, TargetLang),
    FOREIGN KEY (ImageID) REFERENCES Images(ImageID) ON DELETE CASCADE,
    FOREIGN KEY (SourceLang) REFERENCES Languages(languageID) ON DELETE CASCADE,
    FOREIGN KEY (TargetLang) REFERENCES Languages(languageID) ON DELETE CASCADE)
  </code></pre>
  
  <p>As you can see, I am trying to take images according to the "targetLang" column which is an int column.  Each number represent a language.</p>
  
  <p>Now I have two options in selecting images from that table: </p>
  
  <ul>
  <li>Choosing a specific language, i.e. giving a number as the second input.</li>
  <li>Choosing all languages, i.e. setting the second input to be the column name "targetLang".</li>
  </ul>
  
  <p>So I am not comparing to the fixed string "targetLang".  I want to choose all values possible for this column (select targetLang from translationChains).</p>