databricks/Spark-The-Definitive-Guide

Chapter 7 - A small correction in sql code in group query

shanmugavel04 opened this issue · 0 comments

Please find the below correction in the book under the Grouping section
In the book:
--in SQL
%sql
SELECT
count()
FROM
dfTable
GROUP BY
InvoiceNo, CustomerId
+---------+----------+-----+
|InvoiceNo|CustomerId|count|
+---------+----------+-----+
| 536846| 14573| 76|
| 537026| 12395| 12|
| 537883| 14437| 5|
...
| 543188| 12567| 63|
| 543590| 17377| 19|
| C543757| 13115| 1|
| C544318| 12989| 1|
+---------+----------+-----+
correct one:
--in SQL
Select InvoiceNo, CustomerId, count(
)
from dfTable
Group by InvoiceNo, CustomerId

could you please modify the source accordingly?