The result will be a table where the original table contents are 450,000 rows (or records) of precinct election results for each statewide race in Texas.
Here's my query the way it is:
select
UPPER(county) as TXCounty, Name as Presidential_Candidate,
sum(votes) as Votes
from ['2020_General_Election_Returns$']
where name in ('Candidate 1', 'Candidate 2')
group by county, Office, Name
order by County, Office, name
The query results show the county repeated twice, one for candidate 1, the other for candidate 2. Meaning, out of 254 Texas counties, it would return 508 rows instead of 254 because it's duplicating the same county to get the values for candidate 2. Is there a way to create a query where there's two extra columns for candidate 2 and the votes they receive? I'm thinking a nested query would do but I'm not proficient in that area yet. It's a lot cleaner than having the county name repeat for candidate 2.