I denna nedbantade visning så har jag bara resultaten fr 1:a spelaren H1, men det finns sammanlagt 9 spelare i tabellen bo_MatchResult, MatchResultShirtNo 1 - 9. Banta din kod,det där orkar man inte ens sätta sig in i. Har du funderat på att kanske dela upp dina uppgifter i smådelar och sedan samla ihop dem. Tänk på nästa programmerare som skall förstå vad du gjort.Har en SELECT fr en tabell som blir stor går den att göra mindre
Min fråga är om det går att få fram samma resultat med hjälp av IF eller CASE sats?
har lagt ut en html så som jag skulle vilja ha det.
http://www.svbfranking.se/resultat8b.htm
SELECT DISTINCT bo_Club.ClubName,
(SELECT bo_Licence.FirstName + ' ' + bo_Licence.SurName
FROM bo_MatchResult INNER JOIN
bo_Club ON bo_MatchResult.MatchResultTeamId = bo_Club.ClubId INNER JOIN
bo_Match ON bo_MatchResult.MatchResultMatchId = bo_Match.MatchId INNER JOIN
bo_Licence ON bo_MatchResult.MatchResultLicNbr = bo_Licence.LicNbr
WHERE (bo_Match.MatchId = @paramMatchId) AND (MatchResultShirtNo =1) AND (bo_MatchResult.MatchResultHomeOrAwayTeam = 'H')
) AS [H1 SpelarNamn],
(SELECT bo_MatchResult.MatchResultRoundResult1
FROM bo_MatchResult
WHERE MatchResultMatchId = @paramMatchId AND MatchResultShirtNo = 1
AND MatchResultHomeOrAwayTeam = N'H') AS H1Res1Ser1,
(SELECT bo_MatchResult.MatchResultRankPoint1
FROM bo_MatchResult
WHERE MatchResultMatchId = @paramMatchId AND MatchResultShirtNo = 1
AND MatchResultHomeOrAwayTeam = N'H') AS H1Banp1Ser1,
(SELECT bo_MatchResult.MatchResultRoundResult2
FROM bo_MatchResult
WHERE MatchResultMatchId = @paramMatchId AND MatchResultShirtNo = 1
AND MatchResultHomeOrAwayTeam = N'H') AS H1Res1Ser2,
(SELECT bo_MatchResult.MatchResultRankPoint2
FROM bo_MatchResult
WHERE MatchResultMatchId = @paramMatchId AND MatchResultShirtNo = 1
AND MatchResultHomeOrAwayTeam = N'H') AS H1Banp1Ser2,
(SELECT bo_MatchResult.MatchResultRoundResult3
FROM bo_MatchResult
WHERE MatchResultMatchId = @paramMatchId AND MatchResultShirtNo = 1
AND MatchResultHomeOrAwayTeam = N'H') AS H1Res1Ser3,
(SELECT bo_MatchResult.MatchResultRankPoint3
FROM bo_MatchResult
WHERE MatchResultMatchId = @paramMatchId AND MatchResultShirtNo = 1
AND MatchResultHomeOrAwayTeam = N'H') AS H1Banp1Ser3,
(SELECT bo_MatchResult.MatchResultRoundResult4
FROM bo_MatchResult
WHERE MatchResultMatchId = @paramMatchId AND MatchResultShirtNo = 1
AND MatchResultHomeOrAwayTeam = N'H') AS H1Res1Ser1,
(SELECT bo_MatchResult.MatchResultRankPoint4
FROM bo_MatchResult
WHERE MatchResultMatchId = @paramMatchId AND MatchResultShirtNo = 1
AND MatchResultHomeOrAwayTeam = N'H') AS H1Banp1Ser4
FROM bo_MatchResult INNER JOIN
bo_Club ON bo_MatchResult.MatchResultTeamId = bo_Club.ClubId INNER JOIN
bo_Match ON bo_MatchResult.MatchResultMatchId = bo_Match.MatchId INNER JOIN
bo_Licence ON bo_MatchResult.MatchResultLicNbr = bo_Licence.LicNbr
WHERE (bo_Match.MatchId = @paramMatchId) AND (bo_MatchResult.MatchResultHomeOrAwayTeam = 'H')
ORDER BY bo_Club.ClubName
Sv: Har en SELECT fr en tabell som blir stor går den att göra mindre