Files
yankee-gnome-twitch-api/docs/view.sql.md
2025-02-06 12:51:43 -05:00

26 lines
594 B
Markdown

# the view for custom reporting
## Create the View
```
## Drop the view
DROP VIEW IF EXISTS report_twitchdata_top_1500_channels;
CREATE VIEW report_twitchdata_top_1500_channels AS
SELECT
`tag` "username",`url`,`logo` "logo_url", `all_time_peak_viewers`, `avg_viewers` "average_viewers", `followers_gained`, `hours_streamed`, `hours_watched`, `rank`, `total_followers`,
CASE
WHEN total_views = -1 THEN 'null'
ELSE total_views
END AS total_views
from twitch_channel;
-- Select data from the view
SELECT * FROM report_twitchdata_top_1500_channels;
```