我尝试使用计数案例来计算某个列(runs.Finish)中的记录(如果它们等于一个)。
当我像下面第三行那样添加计数案例时,我似乎无法让它工作。
SELECT
`jockeys`.`JockeyInitials`,
`jockeys`.`JockeySurName` ,
COUNT( `runs`.`JockeysID` ),
COUNT( CASE WHEN `runs`.`Finish`=1 THEN 1 ELSE NULL END ) AS `runs`.`Finish` ,
SUM( `runs`.`StakeWon` )
FROM runs, jockeys
WHERE `runs`.`JockeysID` = `jockeys`.`JockeysID`
AND `runs`.`JockeysID` >=1
AND `runs`.`JockeysID` <=100
GROUP BY `runs`.`JockeysID`