roddyyaga / ppx_rapper

Syntax extension for writing SQL in OCaml
Other
139 stars 18 forks source link

Example with multiple joins. #27

Open rawleyfowler opened 1 year ago

rawleyfowler commented 1 year ago

It would be nice to have an example of how to use Rapper.load_many with multiple joins. For example:

SELECT @string{topic.name}, @string{topic.slug},
       @string{post.id}, @string{post.title}, @string{post.content},
       @string{usr.name}, @int{usr.reputation}
FROM board
JOIN post ON post.topic = topic.id
JOIN usr ON usr.id = post.creator
WHERE topic.id = @string{topic.id};