Query editor
WITH question_level AS (SELECTunique_key,question,event_market_name,market_description,MAX(last_uploaded_at) AS last_uploaded_atFROM polymarket_polygon.market_detailsWHERE question LIKE '%Mexico%'AND question LIKE '%South Africa%'GROUP BY 1,2,3,4),classified AS (SELECT *,CASE-- 1. Exact ScoreWHEN lower(question) LIKE '%exact score%'THEN 'Exact Score'-- 2. Corners marketsWHEN lower(question) LIKE '%corner%'THEN 'Corners'-- 3. Both Teams To ScoreWHEN lower(question) LIKE '%both teams to score%'OR lower(question) LIKE '%btts%'THEN 'Both Teams To Score'-- 4. First Team / First EventWHEN lower(question) LIKE '%to score first%'OR lower(question) LIKE '%team to take first%'THEN 'First Event'-- 5. Halftime marketsWHEN lower(question) LIKE '%1st half%'OR lower(question) LIKE '%halftime%'THEN 'Halftime Markets'-- 6. Totals (generic O/U goals)WHEN lower(question) LIKE '%o/u%'AND lower(question) NOT LIKE '%corner%'THEN 'Totals'-- 7. Draw / Match resultWHEN lower(question) LIKE '%draw%'OR lower(question) LIKE '%end in a draw%'THEN 'Match Result / Draw'-- 8. Team-specific totalsWHEN lower(question) LIKE '%mexico%'AND lower(question) LIKE '%o/u%'THEN 'Mexico Team Totals'WHEN lower(question) LIKE '%south africa%'AND lower(question) LIKE '%o/u%'THEN 'South Africa Team Totals'-- 9. First goal / first score variants (extra safety)