I'm trying to replicate a query using Django's ORM; however, I'm having a bit of difficulty figuring out how to accomplish it. The model that I'm querying is defined as:
class Word(models.Model): objects = WordManager() spelling = models.CharField(max_length=128) ipa = models.CharField(max_length=128) The query I'm trying to accomplish: SELECT a.id, a.spelling, a.ipa b.spelling as b_spelling, b.ipa as b_ipa FROM dictionary_word as a, dictionary_word as b WHERE a.ipa != b.ipa and length(a.ipa) = length(b.ipa) and a.ipa = replace(b.ipa, '%s', '%s') The idea of this query is to find all pairs of words that differ by one phoneme (e.g. "mat" and "bat" differ by only one sound). Is this query possible to accomplish with the ORM, or do I need to use a raw query? Thanks, Brad -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.