I'm using Sequel in a personal project, but I need execute a self join.
My application is a publications manager, and one of the business rule, is
that a publication can belong to another publication based on its text
similarity level.
In pure SQL, I wrote the following query that worked well:
SELECT publication.id, publicaton.body AS body, similar_publication.id AS
similar_publication_id, similar_publication.body AS similar_body
FROM publications
LEFT JOIN publications similar_publications ON publications.publication_id =
similar_publication.id;
How can I "translate" this query to Sequel query DSL? I want call my model
like so:
Publication.including_similar_publications.where('publications.id = ?')
I'm in doubt because I need an alias on the left join, and I don't know how
to accomplish that. Can anybody help me?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.