Resolved! How to count the number of campaigns per day based on the start and end dates of the campaigns in SQL Spark Databrick
I need to count the number of campaigns per day based on the start and end dates of the campaignsInput Table: Out needed (result):How do I need to write the SQL command in databricks to get the above result? thanks all
- 3865 Views
- 3 replies
- 15 kudos
Latest Reply
Just create an array with sequence, explode it, and then group and count:WITH cte AS (SELECT `campaign name`, explode(sequence(`Start date`, `End date`, interval 1 day)) as `Date` FROM `campaigns`) SELECT Count(`campaign name`) as `count uni...
- 15 kudos