Fix SQL syntax in join example

This commit is contained in:
Matthias Heinzel 2017-10-13 22:09:28 +02:00
parent 91ea0b0fca
commit 1ca1c3c185
2 changed files with 2 additions and 2 deletions

View File

@ -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).

View File

@ -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: