Hi,
I want to return the first occurrence of repetitive fields in my model.
I have a title field in my model as follows :
models.py
class Post(models.Model):
title = models.CharField(max_length=20)
There will be multiple 'Post' with the same title.
I want to exectute the following query on the Post model
Post.objects.raw("SELECT title,ROW_NUMBER() OVER(PARTITION BY title ORDER
BY title) AS row_num FROM basement_post;")
I am getting a syntax error "("
Is django not compatible with SQL server queries or am I missing something
??
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/bc582b91-fa15-4ad3-a180-54e7457c4f50o%40googlegroups.com.