pyspark-algorithms icon indicating copy to clipboard operation
pyspark-algorithms copied to clipboard

ADD NEW SQL SOLUTION

Open scchy opened this issue 5 years ago • 0 comments

sales_SQL = spark.sql("""SELECT   city, year, sum(amount) as amount 
                                  ,GROUPING_ID(city, year) GFLG
                           FROM   sales_tbl
                       GROUP BY   ROLLUP(city, year)
                         HAVING   3 != GROUPING_ID(city, year) 
                       ORDER BY   city DESC NULLS LAST, year ASC NULLS LAST
                    """)

scchy avatar Jan 03 '20 02:01 scchy