diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-04-09 14:14:15 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-04-09 14:14:15 +0200 |
commit | 9a6b346598d19e13a4bf0d3af6a34573253e16b7 (patch) | |
tree | f9601f76bc593dc40ca7e6345fdaad49eaa3b289 /dbinit/functions.sql | |
parent | 98044423d9f962f4eb6cd6541b6b30a447b23d8f (diff) |
fix views and functions
Diffstat (limited to 'dbinit/functions.sql')
-rw-r--r-- | dbinit/functions.sql | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/dbinit/functions.sql b/dbinit/functions.sql index 4343210..34a64bc 100644 --- a/dbinit/functions.sql +++ b/dbinit/functions.sql @@ -1,3 +1,4 @@ +use `formula1`; drop function if exists udfTotalDistance; delimiter $$ @@ -6,10 +7,8 @@ returns int begin return ( select `circuit`.`length` * `circuit`.`laps` - from `circuit` - inner join `racedatecircuit` on `racedatecircuit`.`circuitID` = `circuit`.`ID` - inner join `racedate` on `racedate`.`ID` = `racedatecircuit`.`raceDateID` - inner join `race` on `race`.`raceDateID` = `racedate`.`ID` + from `race` + inner join `circuit` on `circuit`.`ID` = `race`.`circuitID` where `race`.`ID` = raceID); end$$ |