I have a database where there is only one table for the results of a sport (football).
The table has two columns for the teams and two columns for the score.
+-----+---------------------+-------------------------+-------------------------+-------------+--------------+
| ID | TIME | HOME | VISIT | HOME_RESULT | VISIT_RESULT |
+-----+---------------------+-------------------------+-------------------------+-------------+--------------+
| 1 | 2024-07-20 21:15:00 | Bayern (Furious) | PSG (Ozil) | 4 | 3 |
| 2 | 2024-07-20 21:15:00 | Real Madrid (Dennis) | Inter (Anthem) | 2 | 3 |
| 3 | 2024-07-20 21:00:00 | Real Madrid (Dennis) | PSG (Ozil) | 3 | 1 |
| 4 | 2024-07-20 21:00:00 | Inter (Anthem) | Man City (Cruise) | 3 | 1 |
| 5 | 2024-07-20 20:30:00 | RB Leipzig (Chemist) | Bayern (Nio) | 5 | 4 |
| 6 | 2024-07-20 20:30:00 | Bayer 04 (aibothard) | Dortmund (Panic) | 2 | 2 |
| 7 | 2024-07-20 20:15:00 | VfB Stuttgart (Cantona) | Dortmund (Panic) | 1 | 2 |
| 8 | 2024-07-20 20:00:00 | Napoli (Jack) | Roma (Socrates) | 3 | 1 |
| 9 | 2024-07-20 20:00:00 | Bayern (Nio) | Dortmund (Panic) | 1 | 1 |
| 10 | 2024-07-20 20:00:00 | VfB Stuttgart (Cantona) | RB Leipzig (Chemist) | 2 | 4 |
| 11 | 2024-07-20 19:45:00 | VfB Stuttgart (Cantona) | Bayer 04 (aibothard) | 4 | 1 |
| 12 | 2024-07-20 19:45:00 | RB Leipzig (Chemist) | Dortmund (Panic) | 3 | 6 |
I need two queries but need to know if it’s possible to get values from two columns (HOME and VISIT) simultaneously.
For example in this situation I need to know:
From unique team (HOME and VISIT) how many goals do (HOME_RESULT and VISIT_RESULT)? (i.e Bayern (Nio) have 5. 1 one HOME_RESULT and 4 on VISIT_RESULT)
How many matches do all the unique Teams? In that case how many sort and show unique results? (i.e Bayern (Nio) do 2 matches only)
Thanks in advance