Om man har en Summering t.ex För det första ser det ju inte ut att vara speciellt normaliserat. Hur menar du med speciellt normaliserat? Då borde du kunna göra så här: Hej Niklas, Du har skrivit om Niklas förslag lite konstigt, borde vara något åt detta hållet istället. Hej Johan,Få output på alias?
SELECT DISTINCT ClubName,
SUM(bo_MatchResult.MatchResultRoundResult1) AS Ser1,
SUM(bo_MatchResult.MatchResultRoundResult2) AS Ser2,
SUM(bo_MatchResult.MatchResultRoundResult3) AS Ser3,
SUM(bo_MatchResult.MatchResultRoundResult4) AS Ser4,
Kan man inte på ngt sätt skriva Sum(Ser1, Ser2, Ser3, Ser4) AS Summa?
Eller måste man hela tiden skriva allt?
Sv: Få output på alias?
Men är det du menar helt enkelt följande?
SELECT DISTINCT ClubName,
SUM(bo_MatchResult.MatchResultRoundResult1) AS Ser1,
SUM(bo_MatchResult.MatchResultRoundResult2) AS Ser2,
SUM(bo_MatchResult.MatchResultRoundResult3) AS Ser3,
SUM(bo_MatchResult.MatchResultRoundResult4) AS Ser4,
Ser1 + Ser2 + Ser3 + Ser4 AS SummaSv:Få output på alias?
Testade med att skriva som du föreslog, men får error:
Msg 207, Level 16, State 1, Line 6
Invalid column name 'Ser1'.
Msg 207, Level 16, State 1, Line 6
Invalid column name 'Ser2'.
Msg 207, Level 16, State 1, Line 6
Invalid column name 'Ser3'.
Msg 207, Level 16, State 1, Line 6
Invalid column name 'Ser4'.Sv: Få output på alias?
SELECT Ser1, Ser2, Ser3, Ser4, Ser1 + Ser2 + Ser3 + Ser4 AS Summa FROM
(SELECT DISTINCT ClubName,
SUM(bo_MatchResult.MatchResultRoundResult1) AS Ser1,
SUM(bo_MatchResult.MatchResultRoundResult2) AS Ser2,
SUM(bo_MatchResult.MatchResultRoundResult3) AS Ser3,
SUM(bo_MatchResult.MatchResultRoundResult4) AS Ser4)
<b>>Hur menar du med speciellt normaliserat?</b>
Om du har en siffra med i ett kolumnnamn så kan du nästan vara säker på att du inte har gjort det rätt. Nu ser jag inte exakt vad siffrorna betyder, men i princip ska du istället ha en kolumn till för detta tal.Sv:Få output på alias?
Tog bort ClubName för den kommer fr en annan tabell
Invalid objectname 'SUM'
SELECT MatchResultMatchID,
(SELECT SerA, SerB, SerC, SerD, SerA + SerB + SerC + SerD AS Summa FROM
SUM(bo_MatchResult.MatchResultRoundResult1) AS SerA,
SUM(bo_MatchResult.MatchResultRoundResult2) AS SerB,
SUM(bo_MatchResult.MatchResultRoundResult3) AS SerC,
SUM(bo_MatchResult.MatchResultRoundResult4) AS SerD)
FROM bo_MatchResult
WHERE MatchResultMatchID =2048075
Du får med lite data att testa med.
/****** Object: Default [DF_bo_Match_MatchRoundId] Script Date: 12/21/2007 19:54:42 ******/
IF EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_bo_Match_MatchRoundId]') AND parent_object_id = OBJECT_ID(N'[dbo].[bo_Match]'))
Begin
ALTER TABLE [dbo].[bo_Match] DROP CONSTRAINT [DF_bo_Match_MatchRoundId]
End
GO
/****** Object: Table [dbo].[bo_Club] Script Date: 12/21/2007 19:54:42 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bo_Club]') AND type in (N'U'))
DROP TABLE [dbo].[bo_Club]
GO
/****** Object: Table [dbo].[bo_MatchResult] Script Date: 12/21/2007 19:54:42 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bo_MatchResult]') AND type in (N'U'))
DROP TABLE [dbo].[bo_MatchResult]
GO
/****** Object: Table [dbo].[bo_Match] Script Date: 12/21/2007 19:54:42 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bo_Match]') AND type in (N'U'))
DROP TABLE [dbo].[bo_Match]
GO
/****** Object: Table [dbo].[bo_Match] Script Date: 12/21/2007 19:54:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bo_Match]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[bo_Match](
[MatchId] [int] NOT NULL,
[MatchNo] [nchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MatchHomeTeamId] [int] NOT NULL,
[MatchAwayTeamId] [int] NOT NULL,
[MatchDate] [datetime] NOT NULL,
[MatchStatus] [int] NOT NULL,
[MatchDivisionId] [nchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MatchHallId] [int] NOT NULL,
[MatchRoundId] [int] NOT NULL,
CONSTRAINT [PK_bo_Match] PRIMARY KEY CLUSTERED
(
[MatchId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
END
GO
INSERT [dbo].[bo_Match] ([MatchId], [MatchNo], [MatchHomeTeamId], [MatchAwayTeamId],
[MatchDate], [MatchStatus], [MatchDivisionId], [MatchHallId], [MatchRoundId]) VALUES (2048075, N'0700201087 ', 90659, 89364,
CAST(0x000099F100000000 AS DateTime), 4, N'48967 ', 380002401, 0)
/****** Object: Table [dbo].[bo_MatchResult] Script Date: 12/21/2007 19:54:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bo_MatchResult]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[bo_MatchResult](
[MatchResultMatchId] [int] NOT NULL,
[MatchResultLicNbr] [nchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MatchResultShirtNo] [int] NOT NULL,
[MatchResultRoundResult1] [int] NOT NULL,
[MatchResultRoundResult2] [int] NOT NULL,
[MatchResultRoundResult3] [int] NOT NULL,
[MatchResultRoundResult4] [int] NOT NULL,
[MatchResultTeamId] [int] NOT NULL,
[MatchResultHomeOrAwayTeam] [char](1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MatchResultPlace] [int] NOT NULL,
[MatchResultRankPoint1] [int] NOT NULL,
[MatchResultRankPoint2] [int] NOT NULL,
[MatchResultRankPoint3] [int] NOT NULL,
[MatchResultRankPoint4] [int] NOT NULL,
CONSTRAINT [PK_bo_MatchResult] PRIMARY KEY CLUSTERED
(
[MatchResultMatchId] ASC,
[MatchResultLicNbr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
END
GO
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M011262LAR02 ', 3, 204, 267, 180, 200, 90659, N'H', 2, 1, 1, 1, 1)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M020665BO 01 ', 6, 232, 184, 234, 193, 89364, N'B', 3, 0, 0, 1, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M041062MIC01 ', 1, 174, 186, 193, 246, 90659, N'H', 5, 0, 1, 0, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M080467ULF01 ', 8, 216, 180, 200, 234, 89364, N'B', 4, 1, 1, 0, 1)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M110260THO03 ', 5, 218, 189, 172, 186, 90659, N'H', 10, 1, 0, 1, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M121157LAR01 ', 9, 0, 0, 0, 0, 90659, N'H', 18, 0, 0, 0, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M150656PET01 ', 7, 186, 182, 175, 149, 90659, N'H', 14, 0, 1, 1, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M160567AND01 ', 2, 161, 213, 204, 181, 90659, N'H', 11, 0, 1, 0, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M171188EMI01 ', 1, 184, 178, 0, 194, 89364, N'B', 15, 1, 0, 0, 1)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M180360GER01 ', 6, 209, 199, 201, 190, 90659, N'H', 5, 1, 0, 1, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M200364PET02 ', 5, 190, 197, 185, 202, 89364, N'B', 9, 0, 0, 1, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M220586KEN02 ', 9, 0, 0, 172, 156, 89364, N'B', 17, 0, 0, 0, 1)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M230761MIC01 ', 8, 159, 208, 189, 162, 90659, N'H', 13, 0, 1, 1, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M240669URB01 ', 7, 166, 213, 147, 222, 89364, N'B', 12, 1, 1, 0, 1)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M241166PAT01 ', 4, 187, 220, 185, 185, 89364, N'B', 8, 0, 0, 0, 1)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M251264PET01 ', 4, 206, 258, 257, 213, 90659, N'H', 1, 1, 1, 1, 1)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M270588MIK01 ', 3, 188, 174, 172, 0, 89364, N'B', 16, 0, 0, 0, 0)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048075, N'M310387PET01 ', 2, 201, 237, 168, 185, 89364, N'B', 7, 1, 0, 0, 1)
INSERT [dbo].[bo_MatchResult] ([MatchResultMatchId], [MatchResultLicNbr], [MatchResultShirtNo],
[MatchResultRoundResult1], [MatchResultRoundResult2], [MatchResultRoundResult3], [MatchResultRoundResult4],
[MatchResultTeamId], [MatchResultHomeOrAwayTeam], [MatchResultPlace], [MatchResultRankPoint1], [MatchResultRankPoint2],
[MatchResultRankPoint3], [MatchResultRankPoint4])
VALUES (2048076, N'M010694JER01 ', 1, 201, 198, 227, 196, 107105, N'H', 6, 1, 1, 1, 1)
/****** Object: Table [dbo].[bo_Club] Script Date: 12/21/2007 19:54:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bo_Club]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[bo_Club](
[ClubId] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ClubName] [nchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)
END
GO
INSERT [dbo].[bo_Club] ([ClubId], [ClubName]) VALUES (N'89364 ', N'BK Kaskad ')
INSERT [dbo].[bo_Club] ([ClubId], [ClubName]) VALUES (N'90659 ', N'Uppsala BC 90 ')
/****** Object: Default [DF_bo_Match_MatchRoundId] Script Date: 12/21/2007 19:54:42 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_bo_Match_MatchRoundId]') AND parent_object_id = OBJECT_ID(N'[dbo].[bo_Match]'))
Begin
ALTER TABLE [dbo].[bo_Match] ADD CONSTRAINT [DF_bo_Match_MatchRoundId] DEFAULT ((0)) FOR [MatchRoundId]
End
GO
Sv: Få output på alias?
SELECT SerA, SerB, SerC, SerD, SerA + SerB + SerC + SerD AS Summa FROM
(SELECT
SUM(bo_MatchResult.MatchResultRoundResult1) AS SerA,
SUM(bo_MatchResult.MatchResultRoundResult2) AS SerB,
SUM(bo_MatchResult.MatchResultRoundResult3) AS SerC,
SUM(bo_MatchResult.MatchResultRoundResult4) AS SerD
FROM bo_MatchResult WHERE MatchResultMatchID =2048075)
Persoligen hade jag nog gjort såhär istället, JAG tycker det känns smidigare om man ska bygga vidare på frågan senare, men det är en smaksak...
SELECT ClubName,
SUM(MatchResultRoundResult1) AS Ser1,
SUM(MatchResultRoundResult2) AS Ser2,
SUM(MatchResultRoundResult3) AS Ser3,
SUM(MatchResultRoundResult4) AS Ser4,
SUM(Alla) AS Summa FROM
(SELECT MatchResultMatchID, ClubName,
MatchResultRoundResult1 +
MatchResultRoundResult2 +
MatchResultRoundResult3 +
MatchResultRoundResult4 AS Alla
FROM bo_MatchResult)
WHERE MatchResultMatchID = 2048075
GROUP BY ClubName
/Johan
Sv:Få output på alias?
En helgnöt att knäcka.
Vad jag vill få ut av tabellen bo_MatchResult är:
ClubNamn, MatchResultRoundResult1 AS Ser 1, Ser 2, Ser3, Ser4 Summa MatchResultRankPoints1 AS Banp1, Banp2, Banp3, Banp4,
SummaBanp.
Problemet kommer när man vill jämföra resp hemma o bortalags serie1, serie2, serie3, serie4 Där högre serieresultat ger ett poäng som.
Ett exempel som jag har i DDL en ovan är för hemmalaget serie 1 summan av MatchResultRoundResult1 1517, och för bortalaget 1565,
ger 1 poäng till bortalaget. Allt skall sedan summeras med summaBanp (SUM(Banp1,Banp2, Banp3, Banp4) AS SummaBanp).
Det här är vad jag har hittintills:
SELECT DISTINCT bo_Club.ClubName,
SUM(bo_MatchResult.MatchResultRoundResult1) AS Ser1, SUM(bo_MatchResult.MatchResultRoundResult2) AS Ser2,
SUM(bo_MatchResult.MatchResultRoundResult3) AS Ser3, SUM(bo_MatchResult.MatchResultRoundResult4) AS Ser4,
SUM(bo_MatchResult.MatchResultRankPoint1 + bo_MatchResult.MatchResultRankPoint2 +
bo_MatchResult.MatchResultRankPoint3 + bo_MatchResult.MatchResultRankPoint4)/2 AS Banp, MatchResultHomeOrAwayTeam
FROM bo_Match INNER JOIN
bo_MatchResult ON bo_Match.MatchId = bo_MatchResult.MatchResultMatchId INNER JOIN
bo_Club ON bo_MatchResult.MatchResultTeamId = bo_Club.ClubId
GROUP BY bo_Club.ClubName, bo_Match.MatchId, bo_MatchResult.MatchResultHomeOrAwayTeam
HAVING (bo_Match.MatchId = 2048075)