title: How to pass variables in spark SQL, using SparkR?
body: <p>I am new in SparkR. I am trying to write a query on a dataset using SparkR using Qubole Notebook. several process taken but not getting the output.</p>
  <p>Data: Table_A</p>
  <pre><code>ID      Name     month      year
  1        A         2        2020
  2        B         2        2019
  3        c        12        2019
  </code></pre>
  <p>Desired Output:</p>
  <pre><code>ID      Name     month      year
  1        A         2        2020
  </code></pre>
  <p><img src="https://i.stack.imgur.com/iHyfC.png" alt="enter image description here" /></p>
  <p>Variables:</p>
  <pre><code>month_value= 2
  year_value = 2020
  </code></pre>
  <h1 id="process-1-mvtw">Process 1:</h1>
  <pre><code>temp_data = sql(&quot;
  select * 
  from Table_A
  where month = $month_value and year = $year_value&quot;)
  </code></pre>
  <h1 id="process-2-sai6">Process 2:</h1>
  <pre><code>temp_data = sql(s&quot;
  select * 
  from Table_A
  where month = $month_value and year = $year_value&quot;)
  </code></pre>
  <h1 id="process-3-fxrs">Process 3:</h1>
  <pre><code>temp_data = sql(&quot;
  select * 
  from Table_A
  where month = {0} and year = {1}&quot;.format(month_value,year_value))
  </code></pre>
  <h1 id="process-4-4jfk">Process 4:</h1>
  <pre><code>temp_data = sql(&quot;
  select * 
  from Table_A
  where month = ${month_value} and year = ${year_value}&quot;)
  </code></pre>
  <p>How to pass the variables in spark SQL, using SparkR?</p>