Prompt
Return two rows:
- Sam LaPorta’s 2024 regular-season totals.
- The combined totals of every other NFC North tight end in 2024 — every
GB, MIN, and CHI player with
position_group = 'TE', aggregated into a single row labeledNFC North TEs (ex-DET).
Both rows should have the same columns: label, games, catches, yards, TDs.
Expected output
| label | games | catches | yards | tds |
|---|---|---|---|---|
| Sam LaPorta | … | … | … | … |
| NFC North TEs (ex-DET) | … | … | … | … |
Hint
Two queries UNION ALL’d together. The first selects literal 'Sam LaPorta'
as the label; the second selects literal 'NFC North TEs (ex-DET)'. Both
queries aggregate from weekly_stats with different WHERE filters.
Solution
SELECT 'Sam LaPorta' AS label, COUNT(*) AS games, SUM(receptions) AS catches, SUM(receiving_yards) AS yards, SUM(receiving_tds) AS tdsFROM weekly_statsWHERE player_display_name = 'Sam LaPorta' AND season = 2024 AND season_type = 'REG' AND targets > 0
UNION ALL
SELECT 'NFC North TEs (ex-DET)' AS label, COUNT(*) AS games, SUM(receptions) AS catches, SUM(receiving_yards) AS yards, SUM(receiving_tds) AS tdsFROM weekly_statsWHERE recent_team IN ('GB', 'MIN', 'CHI') AND position_group = 'TE' AND season = 2024 AND season_type = 'REG' AND targets > 0;UNION ALL stacks rows. UNION (without ALL) deduplicates, which you don’t
want here. Column names come from the first query; the second query must
match column count and types.