A digital marketing agency needs to analyze user activity across multiple platforms (web and mobile) to ensure data accuracy. Write a SQL query to calculate the total activity count for each user, along with their last activity date, while ensuring that data from both platforms is accurately represented.
users, web_activity, and mobile_activity tables.users (id, name)
web_activity (user_id, activity_date)
mobile_activity (user_id, activity_date)
| users | web_activity | mobile_activity |
|---|---|---|
| id | user_id | user_id |
| ------- | -------------- | ----------------- |
| INT | INT | INT |
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 3 | 3 | NULL |
| user_id | total_activity | last_activity_date |
|---|---|---|
| 1 | 5 | 2024-01-05 |
| 2 | 3 | 2024-01-03 |
| 3 | 1 | 2024-01-01 |