title: Spark SQL - load data with JDBC using SQL statement, not table name
body: <p>I think I am missing something but can't figure what.
  I want to load data using SQLContext and JDBC using particular sql statement
  like</p>
  
  <pre><code>select top 1000 text from table1 with (nolock)
  where threadid in (
    select distinct id from table2 with (nolock)
    where flag=2 and date &gt;= '1/1/2015' and  userid in (1, 2, 3)
  )
  </code></pre>
  
  <p>Which method of SQLContext should I use? Examples I saw always specify table name and lower and upper margin.</p>
  
  <p>Thanks in advance.</p>