title: SparkSQL - The correlated scalar subquery can only contain equality predicates
body: <p>I would like to execute the following query with Spark SQL 2.0</p>
  
  <pre><code>SELECT
  a.id as id,
  (SELECT SUM(b.points) 
    FROM tableB b 
    WHERE b.id = a.id AND b.date &lt;= a.date) AS points
  FROM tableA a
  </code></pre>
  
  <p>but I get the following error </p>
  
  <p><code>The correlated scalar subquery can only contain equality predicates</code>.</p>
  
  <p>Any idea how can I rewrite the query or use operations between the two dataframes tableA and tableB to make it working?</p>