SQL-将一个查询除以另一个

我正在尝试创建一个查询,该查询返回锻炼百分比完成率...

锻炼百分比完成率=

(LogEntries WHERE日期= IN日期列表和WorkoutID = 1的总和)/

(所有设置的数字的总和,其中WHERE WorkoutID = 1) x 100

以下是我目前拥有的内容,目前仅返回第一个查询的结果。 我应该更改什么才能使查询正确运行?

SELECT 
(SELECT COUNT(LogEntriesID) FROM LogEntriesTable 
LEFT JOIN ExerciseWorkoutJunctionTable ON 
ExerciseWorkoutJunctionTable.ExerciseWorkoutJunctionID = LogEntriesTable.JunctionID 
WHERE LogEntriesTable.date IN ("14-05-2020","15-05-2020","16-05-2020","17-05-2020",
"18-05-2020","19-05-2020","20-05-2020") 
AND ExerciseWorkoutJunctionTable.WorkoutID = 1) 
% 
(SELECT sum(SetNumber) FROM ExerciseWorkoutGoalsTable 
LEFT JOIN ExerciseWorkoutJunctionTable 
ON ExerciseWorkoutJunctionTable.ExerciseWorkoutJunctionID 
= ExerciseWorkoutGoalsTable.JunctionID 
WHERE ExerciseWorkoutJunctionTable.WorkoutID = 1) 
评论