'How to write query nested subquery using Djnago ORM?
please help me to write something like this query using Django ORM:
SELECT label from (
SELECT DISTINCT on (label)
unnest("auditorial"."labels") AS "label"
FROM "auditorial"
) as subQ
WHERE upper(label) LIKE upper('%rec%')
ORDER BY label
If I have model like this:
class Auditorial(models.Model):
labels = ArrayField(
models.CharField(max_length=64, blank=True)
)
I need to provide "suggestions" into select input on website
Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|