title: select multiple elements with group by in spark.sql
body: <p>is there any way to group by table in sql spark which selects multiple elements 
  code i am using:</p>
  
  <pre><code>val df = spark.read.json("//path")
  df.createOrReplaceTempView("GETBYID")
  </code></pre>
  
  <p>now doing group by like :</p>
  
  <pre><code>val sqlDF = spark.sql(
    "SELECT count(customerId) FROM GETBYID group by customerId");
  </code></pre>
  
  <p>but when I try:</p>
  
  <pre><code>val sqlDF = spark.sql(
    "SELECT count(customerId),customerId,userId FROM GETBYID group by customerId");
  </code></pre>
  
  <p>Spark gives an error :</p>
  
  <blockquote>
    <p>org.apache.spark.sql.AnalysisException: expression 'getbyid.<code>userId</code>'
    is neither present in the group by, nor is it an aggregate function.
    Add to group by or wrap in first() (or first_value) if you don't care
    which value you get.;</p>
  </blockquote>
  
  <p>is there any possible way to do that </p>