Fix SQL syntax in join example
This commit is contained in:
parent
91ea0b0fca
commit
1ca1c3c185
@ -192,7 +192,7 @@ which generates this SQL:
|
||||
SELECT P1.*, Follow.*, P2.*
|
||||
FROM Person AS P1
|
||||
INNER JOIN Follow ON P1.id = Follow.follower
|
||||
INNER JOIN P2 ON P2.id = Follow.followed
|
||||
INNER JOIN Person AS P2 ON P2.id = Follow.followed
|
||||
```
|
||||
|
||||
Note carefully that the order of the ON clauses is reversed! You're required to write your `on`s in reverse order because that helps composability (see the documentation of `on` for more details).
|
||||
|
||||
@ -315,7 +315,7 @@ import qualified Database.Persist
|
||||
-- SELECT P1.*, Follow.*, P2.*
|
||||
-- FROM Person AS P1
|
||||
-- INNER JOIN Follow ON P1.id = Follow.follower
|
||||
-- INNER JOIN P2 ON P2.id = Follow.followed
|
||||
-- INNER JOIN Person AS P2 ON P2.id = Follow.followed
|
||||
-- @
|
||||
--
|
||||
-- In @esqueleto@, we may write the same query above as:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user