Skip to content
Discussion options

You must be logged in to vote

Well, after much time throwing stuff at the wall, I found that moving the where clause from 6 and 7 in to their relevant joins and swapping the .eq order it fixed it. I have absolutely no idea why :)

The changed bit of code.

let joinedQueens = joinedLocations.leftJoin(Queen.all) { _,ql, q in 
           ql.queenID.eq( q.id)   && 
           ql.date.eq(
                QueenLocation.select{ $0.date.max() }
                    .where { $0.queenID.eq(q.id )
                    }
                ?? Date.distantPast)
        }
        
        // 4) Join milestones for those queens
        let joinedMilestones = joinedQueens.leftJoin(QueenMilestone.all) {_,_, q, qm in 
            q.id.eq(qm.q…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@mbrandonw
Comment options

@ajaxharg
Comment options

Answer selected by ajaxharg
Comment options

You must be logged in to vote
2 replies
@mbrandonw
Comment options

@ajaxharg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants