         }
         
         for join in rightQuery.joins {
-            sql += try " " + join.joinSQL(db, &arguments, leftQualifier: rightQualifier)
+            sql += try " " + join.joinSQL(db, &arguments, leftQualifier: rightQualifier, isRequiredAllowed: isRequiredAllowed)
         }
         
         return sql

    var key: String
    var associationMapping: (Database) throws -> AssociationMapping
    
    func joinSQL(_ db: Database,_ arguments: inout StatementArguments?, leftQualifier: SQLTableQualifier) throws -> String {
        var sql = ""
        switch op {
        case .optional: sql += "LEFT JOIN"
        case .required: sql += "JOIN"
        }
        
        let rightQualifier = rightQuery.qualifier!

        sql += try " FROM " + source.sourceSQL(db, &arguments)
        
        for join in joins {
            sql += try " " + join.joinSQL(db, &arguments, leftQualifier: qualifier!, isRequiredAllowed: true)
        }
        
        if let filter = try filterPromise.resolve(db) {
